Opened 4 years ago

Closed 3 years ago

#9648 closed bug (duplicate)

ghci fails to reload after deleting/creating an imported module

Reported by: NeilMitchell Owned by:
Priority: normal Milestone:
Component: GHCi Version: 7.8.3
Keywords: Cc: hvr, ndmitchell@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #11596 Differential Rev(s):
Wiki Page:

Description (last modified by thomie)

If you start GHCi with a 2 module program, delete the child module, reload, you get an error (as expected). If you recreate the child module and reload, it reloads the child module but erroneously claims that parent can't find the child.

Note that if you rename the child to something else, then rename it back, then the test works - so it seems the reappearance and the file stamp confuses ghci. Spotted while working on ghcid: https://github.com/ndmitchell/ghcid

$ echo module Util where > Util.hs

$ echo "import Util; main = print 1" > Main.hs

$ ghci Main.hs
GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 2] Compiling Util             ( Util.hs, interpreted )
[2 of 2] Compiling Main             ( Main.hs, interpreted )
Ok, modules loaded: Util, Main.
*Main> :!del Util.hs     -- on Linux -->  :!rm Utils.hs 
*Main> :r

Main.hs:1:8:
    Could not find module `Util'
    It is a member of the hidden package `ghc-7.8.3'.
    Use -v to see a list of the files searched for.
Failed, modules loaded: Util, Main.
*Main> :!echo module Util where > Util.hs
*Main> :r
[1 of 2] Compiling Util             ( Util.hs, interpreted )
[2 of 2] Compiling Main             ( Main.hs, interpreted ) [Util changed]

Main.hs:1:1:
    Failed to load interface for `Util'
    It is a member of the hidden package `ghc-7.8.3'.
    Use -v to see a list of the files searched for.
Failed, modules loaded: Util.

Change History (4)

comment:1 Changed 4 years ago by NeilMitchell

Description: modified (diff)

comment:2 Changed 4 years ago by NeilMitchell

Cc: ndmitchell@… added

comment:3 Changed 4 years ago by thomie

Description: modified (diff)

Still present in ghc-7.9.20141108. I edited the description to make it Linux compatible.

comment:4 Changed 3 years ago by thomie

Resolution: duplicate
Status: newclosed

Let's continue this in #11596.

Note: See TracTickets for help on using tickets.