Cabal: Typechecking without code generation in the REPL

Created on 17 Jul 2019  路  5Comments  路  Source: haskell/cabal

What's the proper way to load a project into the REPL without generating code at each :reload?

ghcid tries to execute cabal repl --ghc-options=-fno-code but that fails quickly due to missing object files, e.g.

/usr/bin/ar: dist/build/Data/Serialize.o: No such file or directory

Most helpful comment

I think a better answer is

cabal new-repl --repl-options="-fno-code"

All 5 comments

I use a .ghc.environment file and a hand-written .ghci to make ghcid work.

@23Skidoo cool! Can you share a sample of a .ghci that works well for you?

So in my .ghcid I have

--command "ghci -fno-code -j4 +RTS -A128m"

And the .ghci looks like

:set -XBangPatterns
[...]

:set -Weverything
:set -Wno-all-missed-specialisations
:set -Wno-implicit-prelude
:set -Wno-missed-specialisations
:set -Wno-missing-export-lists
:set -Wno-missing-import-lists
:set -Wno-missing-local-signatures
:set -Wno-monomorphism-restriction
:set -Wno-safe
:set -Wno-unsafe

:set -ipath/to/custom-prelude/src
:set -ipath/to/local-lib1/src/
:set -ipath/to/local-lib2/src/
:set -ipath/to/local-exe/src

:load Main

I also have

write-ghc-environment-files: always

in my cabal.project.

I think a better answer is

cabal new-repl --repl-options="-fno-code"

Thank you @mpickering. That's precisely what I was looking for! :)

Was this page helpful?
0 / 5 - 0 ratings