Closed changlinli closed 6 months ago
In particular while the vanilla Elm compiler uses -O2
as a GHC flag, that probably applies only to the executable. I want to apply -O2
to the entire dependency tree
Turns out if we specify the optimization level in cabal.project
instead of passing --enable-optimizations
as a flag, cabal list-bin
does just fine.
That's enough to close the issue since getting cabal install
to work is not as pressing
Quick Summary:
Currently we use a combination of
cabal build
andcabal list-bin
to extract a binary that's built by Elm. This is becausecabal install
results in a Template Haskell error related tochangeWorkingDirectory
.It would be much more ideal to use
cabal install
directly instead of this two-step hack, both because that's the preferred way to actually generate binaries with Cabal, but also becausecabal list-bin
is quite fragile in the face of different Cabal build optimizations. E.g.cabal list-bin
no longer lists the correct directory path if I pass optimization flags to Cabal, so the current executable is just not using the highest optimization level (I wonder if the vanilla Elm compiler is affected by this as well and hence isn't actually as fast it could be with-O2
used instead of just-O1
).This issue tracks solving that TH error when using
cabal install
. It might be the case that we give up using Template Haskell altogether and embed the data for thereactor
subcommand some other way as a post-compile step.SSCCE
Run
cabal install
and we get the following error: