While browsing issues in the cabal github repository I encountered this comment by Oleg Grengrus:
ghc-options: -O2(any -O flag) to be at the very least questionable practice.
cabal.projectyou can have
for all local, or per package (also non-local)
The core idea is that optimizations could be configured for all packages in an uniform way, without investigating if there’s some
Also as a bonus, changing optimization level (also possible from command line), won’t cause full recompilation (or worse: mixed-level compilation) as build products are kept separate.
This was news to me, so I thought some people here could also benefit from seeing this.