cabal repl load single module
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I have a large project with a lot of modules that form an Executable. I'd like to use cabal repl to load up a single source file, reusing the objects that cabal build has already build
as needed for its dependencies.
If I just run "cabal repl", it loads every module in my project. This takes rather a long time. Even :r in the resulting repl takes a noticiable number of seconds. Long enough that my mind wanders. (Also, ghci's " Ok, modules loaded: " line is so long that any compilation error messages are pushed way off the top of the screen.)
Instead, I'd like to be able to run "cabal repl My.Module", and have it load only that module and its dependencies. This would let it load much faster.
Before cabal repl, I had a hack that used basically the same approach; running cabal build, grepping out the ghc --make, and reusing the same set of options (with some ugly tweaks to make it work) when starting ghci. With my hack, I am able to start ghci on a specified souce file, loading only that file (and its dependencies), reusing the cabal build objects. So, I know this can be done.
btw, dcoutts tells me there is some code in cabal that anticipates using cabal repl this way.
Contributor guide
Assessment
This issue has not been assessed yet.