[Haskell-cafe] How can I use “cabal repl” without base

Adam Steen adam at adamsteen.com.au
Fri Mar 17 11:47:21 UTC 2017


Hi

How can I use cabal repl (ghci) without base?

The following contrived example shows the error

-- minimal.hsmodule Minimal where

myId :: a -> a
myId x = x

and

-- minimal.cabal
name: minimal
version: 0.0.1
build-type: Simple
cabal-version: >= 1.10

library
  exposed-modules: Minimal
  --build-depends: base
  default-language: Haskell2010
  default-extensions:  NoImplicitPrelude

cabal build succeeds

$ cabal build
Building minimal-0.0.1...
Preprocessing library minimal-0.0.1...[1 of 1] Compiling Minimal
   ( Minimal.hs, dist\build\Minimal.o )

but cabal repl fails

$ cabal repl
Preprocessing library minimal-0.0.1...
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
<interactive>:1:6: error:
    Not in scope: `System.IO.hSetBuffering'
    No module named `System.IO' is imported.
<interactive>:1:30: error:
    Not in scope: `System.IO.stdin'
    No module named `System.IO' is imported.
<interactive>:1:46: error:
    Not in scope: data constructor `System.IO.NoBuffering'
    No module named `System.IO' is imported.
<interactive>:1:70: error:
    Not in scope: `System.IO.hSetBuffering'
    No module named `System.IO' is imported.
<interactive>:1:94: error:
    Not in scope: `System.IO.stdout'
    No module named `System.IO' is imported.
<interactive>:1:111: error:
    Not in scope: data constructor `System.IO.NoBuffering'
    No module named `System.IO' is imported.
<interactive>:1:135: error:
    Not in scope: `System.IO.hSetBuffering'
    No module named `System.IO' is imported.
<interactive>:1:159: error:
    Not in scope: `System.IO.stderr'
    No module named `System.IO' is imported.
<interactive>:1:176: error:
    Not in scope: data constructor `System.IO.NoBuffering'
    No module named `System.IO' is imported.

if i restore "build-depends: base" if works as expected.

$ cabal repl
Preprocessing library minimal-0.0.1...
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help[1 of 1]
Compiling Minimal          ( Minimal.hs, interpreted )
Ok, modules loaded: Minimal.*Minimal>

i know just keeping "build-depends: base" will make it work, but thats not
what i am asking.

Note: this also applies for stack

Cheers

Adam


ps this is cross posted from stackoverflow
<http://stackoverflow.com/q/42823547/415681>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170317/ba950b94/attachment.html>


More information about the Haskell-Cafe mailing list