ghci fails to reload after deleting/creating an imported module
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.
Edited by Thomas Miedema