You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Reacted by Sean Leather, Frederik Hanghøj Iversen, Erik de Castro Lopo, Trevor Elliott, Herbert Valerio Riedel, Rob Rix, julian1, Dmitrii Kovanikov, Enis Bayramoğlu, malte-v and 5 more
For what it's worth, I've never used cabal repl, and so I'll support UI changes by those of you who do use it. (For me, most of the time I just want to get the GHC command line args out of Cabal so I can run them myself.)
I usually use cabal exec ghci instead of cabal repl for exactly the reasons listed above. Recently, I've been using cabal new-repl to take advantage of the new-build functionality, and was thinking that an option to not load any modules would fix my original gripes with cabal repl. This seems simpler to me, though I do see the advantage of being able to specify a list of modules to load (when working on a parser, for example).
Activity
codygman commentedon May 25, 2015
Just wanted to say this sounds like a good enhancement.
osa1 commentedon May 30, 2015
I was reading the source and found this: https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Setup.hs#L1549 Apparently cabal supported this at some point.
erikd commentedon Jul 12, 2016
I wonder if the current behavior of
cabal replis actually what is most useful for most people.There are a number of differences in the behavior of
cabal replthat are different fromcabal repl -- ghci ...that I find suprising and unhelpful.ezyang commentedon Jul 12, 2016
For what it's worth, I've never used cabal repl, and so I'll support UI changes by those of you who do use it. (For me, most of the time I just want to get the GHC command line args out of Cabal so I can run them myself.)
erikd commentedon Jul 12, 2016
Ok, I'll set up a bunch of little demo projects that demonstrate what I think are problems with
cabal repland see what can and should be fixed.elliottt commentedon Sep 10, 2016
I usually use
cabal exec ghciinstead ofcabal replfor exactly the reasons listed above. Recently, I've been usingcabal new-replto take advantage of thenew-buildfunctionality, and was thinking that an option to not load any modules would fix my original gripes withcabal repl. This seems simpler to me, though I do see the advantage of being able to specify a list of modules to load (when working on a parser, for example).Rename Algorithm.ShortestPath to Graph.ShortestPath