How do i use runhaskell with cabal-dev?

2020-06-08 15:14发布

问题:

Unfortunately cabal-dev ghci does not work in this project, i get an error:

Loading package download-0.3.2 ... linking ... 
ghc: /home/stulli/haskell/ifdl/cabal-dev//lib/download-0.3.2/ghc-7.4.1/HSdownload-0.3.2.o: unknown symbol `stat64'
ghc: unable to load package `download-0.3.2'

So i try runhaskell, but it uses the packages that come installed with cabal instead of cabal-dev and thus fails.

update: runhaskell produces the same error:

$ runhaskell -isrc:src/test -package-conf=cabal-dev/packages-7.4.1.conf src/test/Test.hs
Test.hs: /home/stulli/haskell/ifdl/cabal-dev//lib/download-0.3.2/ghc-7.4.1/HSdownload-0.3.2.o: unknown symbol `stat64'
Test.hs: Test.hs: unable to load package `download-0.3.2'

cabal-dev install on the other hand works without problems.

回答1:

You can try something like the next:

runhaskell -package-conf=cabal-dev/packages-7.0.3.conf main.hs

But I think if cabal-dev ghci doesn't work, then runhaskell will not work too. You need to find out what is wrong with download package.



回答2:

To use runhaskell with cabal sandboxes (cabal >= 1.18), run the command

runhaskell -package-db=.cabal-sandbox/i386-windows-ghc-7.6.3-packages.conf.d <file.hs>

substituting the proper *-packages.conf.d directory for your GHC version.



回答3:

The cabal-dev setup doesn't work very well for ghci, so it might very well be that it also doesn't work well for runhaskell. Maybe virthualenv will work better for this use case?