[GHC] #9648: ghci fails to reload after deleting/creating an imported module

GHC ghc-devs at haskell.org
Mon Nov 10 17:26:26 UTC 2014


#9648: ghci fails to reload after deleting/creating an imported module
-------------------------------------+-------------------------------------
              Reporter:              |            Owner:
  NeilMitchell                       |           Status:  new
                  Type:  bug         |        Milestone:
              Priority:  normal      |          Version:  7.8.3
             Component:  GHCi        |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Old description:

> 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
> *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.
> }}}

New description:

 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.
 }}}

--

Comment (by thomie):

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

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9648#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list