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
On the other though, it might be confusing when cabal run exe-in-project is first compiled. Maybe the default between compilation and interpretation should be consistent. Yet, adding runghc support is a good start.
Interpreter (as in ghc --run) brings speedups when the script keeps changing. But if I want to re-run the same thing multiple times, the compiled version will be faster in general. So, there's a tradeoff, and the choice should probably be left to user by providing the corresponding flag, e.g. cabal run --interpret if the default is compiling. Here are timings for a simple script depending on several packages (async, containers, optparse-applicative):
unchanged script
after an edit
cabal run today (compiled)
0.11 s
1.45–1.50 s
cabal run --interpret, with a quick prototype
0.78 s
0.78 s
bare ghc --run, same packages
0.23–0.34 s
0.23–0.24 s
A tip from LLM: the multi-repl code path in CmdRepl.hs is already doing something very close (collects flags during the build phase and start GHCi afterwards) around lines 516--588. A good implementation would start from a refactor...
Activity
phadej commentedon Apr 5, 2020
On the other though, it might be confusing when
cabal run exe-in-projectis first compiled. Maybe the default between compilation and interpretation should be consistent. Yet, addingrunghcsupport is a good start.hvr commentedon Apr 5, 2020
This would be more a lot more convenient to do if we had
ghc --runsupport (see https://gitlab.haskell.org/ghc/ghc/issues/18011) just like we don't invoke the repl viaghcibut rather directly viaghc --interactive. Passing GHC arguments torunghcis a bit awkward and I'm not sure ifrunghchas any support for "response files".h6agpt5 commentedon Nov 15, 2026
Now that GHC supports
ghc --run, would it be worth revisiting this proposal?zlonast commentedon Nov 15, 2026
@h6agpt5 Hi, we’d be happy for you to give this a try, feel free to open a pull request.
ulysses4ever commentedon Nov 16, 2026
Interpreter (as in
ghc --run) brings speedups when the script keeps changing. But if I want to re-run the same thing multiple times, the compiled version will be faster in general. So, there's a tradeoff, and the choice should probably be left to user by providing the corresponding flag, e.g.cabal run --interpretif the default is compiling. Here are timings for a simple script depending on several packages (async, containers, optparse-applicative):cabal runtoday (compiled)cabal run --interpret, with a quick prototypeghc --run, same packagesA tip from LLM: the multi-repl code path in CmdRepl.hs is already doing something very close (collects flags during the build phase and start GHCi afterwards) around lines 516--588. A good implementation would start from a refactor...