[Haskell-cafe] How can I use “cabal repl” without base
Adam Bergmark
adam at bergmark.nl
Fri Mar 17 12:19:59 UTC 2017
This is needed for ghci to print results so i dont' think there's a
workaround. You could use a cabal flag to configure your lib for repl use
base conditionally, or so i assume.
Or use an exe or test suite that adds the dep.
HTH,
Adam
On Fri, 17 Mar 2017 at 12:51, Adam Steen <adam at adamsteen.com.au> wrote:
> 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>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170317/540bb639/attachment.html>
More information about the Haskell-Cafe
mailing list