import Data.List
a = foldl' (+) 0 [1..99999999]
main = putStrLn $ show $ a
This program takes a while to run. But a
does not depend on anything and thus is constant. It could be perfectly calculated at compile time. Why is not GHC optimizing for this? Is there a flag for it to do so, or should I just replace that kind of constant calculation by the values themselves?