[GHC] #10920: ghci can't load local Prelude module

GHC ghc-devs at haskell.org
Sat Oct 8 12:20:44 UTC 2016


#10920: ghci can't load local Prelude module
-------------------------------------+-------------------------------------
        Reporter:  Yuras             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  7.10.1
      Resolution:                    |             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/10920#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list