viewing core when compiling with cabal

cabal, ghc, haskell

Solution

You can use `-ddump-to-file` and GHC will write to files with names like `foo.dump-simpl`, etc for the other debugging options. If you put it in your cabal file I believe it will dump them at the top level of your project.

Problem

When building my application, I would like cabal to automatically output the intermediate core to a file. I can add the `-ddump-simpl` flag to the cabal file's `ghc-options` field, but this prints everything to stdout. Is there a way I can get cabal to redirect all of this to a file?

Original source