[GHC] #7416: ghci "attempting to use module ... which is not loaded" after cabal install, in source dir

GHC ghc-devs at haskell.org
Sat Oct 8 12:18:00 UTC 2016


#7416: ghci "attempting to use module ... which is not loaded" after cabal
install, in source dir
-------------------------------------+-------------------------------------
        Reporter:  j.waldmann        |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  7.6.1
      Resolution:  invalid           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by phadej):

 A workaround which seems to work for hackage-security:

 First: write a .ghci file with:

 {{{
 :load src/Prelude.hs
 import Prelude
 :set -XImplicitPrelude
 }}}

 As cabal doesn't give ability to pass /only/ ghci-flags atm use `cabal
 repl -v` or `cabal new-repl -v` to get a command line cabal uses:
 something like

 {{{
 /opt/ghc/8.0.1/bin/ghc --interactive -fbuilding-cabal-package -O0
 -outputdir ...
 }}}

 then add a `-XNoImplicitPrelude` there

 {{{
 /opt/ghc/8.0.1/bin/ghc --interactive -XNoImplicitPrelude -fbuilding-cabal-
 package -O0 -outputdir ...
 }}}

 ---

 This works because

 - if `-XNoImplicitPrelude` is specified `ghci` doesn't implicitly load
 Prelude
 - after that `.ghci` file is loaded, where we load right `Prelude.hs` and
 import it, and turn implicit prelude on
 - loading of package proceeds

 It seems to work, but fragile it seems.

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


More information about the ghc-tickets mailing list