Need to clarify on build and repl #11935
Unanswered
AVBharath10
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Is there a supported way to make
cabal repl <pkg> --repl-options=-fobject-codereuse the object files produced by a priorcabal build <pkg>, or is a full recompile expected because of the ephemeral component the REPL synthesizes?Environment
cabal --version)What I expected
If
cabal buildandcabal replare configured with the same optimization level and the same way flags (including dynamic objects on macOS), I expectedcabal repl --repl-options=-fobject-codeto reuse the.o/.dyn_o/.hifiles already produced bycabal buildand skip recompilation.What actually happens
Even when I align optimization levels, the REPL recompiles all 222 modules from scratch on every invocation.
Attempt 1 —
--ghc-options="-O0"on both commandsTwo things stand out:
Build profile:line still reports-O1, even though--ghc-options="-O0"was passed. My understanding is that--ghc-optionsis appended to the GHC command line but does not change Cabal's build profile / store hash. Is that correct?(ephemeral targets)note suggests the REPL is configured as a distinct component from the onecabal buildproduced, which I suspect is the actual reason no artifacts are reused.Attempt 2 — setting optimization at the project level
I also tried setting it in
cabal.project.local:(Will post the resulting
Build profile:lines and recompilation behavior in a follow-up — running the experiment now.)Specific questions
cabal build <pkg>andcabal repl <pkg> --repl-options=-fobject-codea supported workflow in current Cabal, or is the ephemeral REPL component expected to always trigger a recompile?shared/-dynamic-too, profiling,ghc-options, etc.)?For context: with a 222-module library, a cold
cabal repltakes several minutes, which makes iteration painful. I'm aware ofghcidas a workaround for the per-edit case, but I'd still like to understand whether the underlying artifact sharing is achievable.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions