Part of the trick relies on getting cabal to output environment files (package names, versions/hashes) with the `–write-ghc-environment-files=always` flag. I cannot find an equivalent flag in stack. Is there a workaround?
Did anyone face this rather specific problem before? Thanks in advance
An alternative to using the environment file is just passing all the flags that stack would manually. Run stack with a higher verbosity and that should print out the ghc invocations. Then, you can use the same flags needed to compile your module with the additional options Ben described. Perhaps add -fforce-recomp too, to be sure
Ah well caught. Ben’s method is for profiling the execution of the splice itself, not for profiling the execution of the expression produced by executing the splice
Ah, yes of course. Thank you and apologies for the confusion!
One day I might be also interested in profiling the compilation itself, it’s a little compiler inside a QuasiQuoter, but for now I care only about the generated programs.
I looked at the output of stack runghc -- Setup.hs configure --help and stack runghc -- Setup.hs build --help (with Cabal-3.12.1.0 - GHC 9.10.3), and can’t see that Cabal (the library) provides a documented --write-ghc-environment-files option. As Stack builds with Cabal, Cabal support may be a prerequisite for Stack support.