I have a cabal project, which I'm building with new-build. I have configured my library to use -O0 when I pass a dev flag, and to use -O2 for production builds.
The relevant stanza in my cabal file is
if (flag(dev)) || (flag(library-only))
ghc-options: -O0
cpp-options: -DDEVELOPMENT
else
ghc-options: -O2
However, if I do cabal new-build -f dev, cabal passes the -O1 option for some reason.
I can get around this by passing in --disable-optimization, but I'm curious why -f dev behaves this way
As far as I know, this is because cabal passes
-O1by default, and adding the-O0flag doesn't tell it to not pass the other flag :-)