Option to dump preprocessed source
It would be awesome if GHC had an option
-ddump-preprocessed that dumps the source code for each module after preprocessing. I am not sure what the current definition of "preprocessing" is but I mean the output of at least the following tools: happy, alex, c2hs, hsc2hs and cpp. Additionally even if a module was not subject to any preprocessing it should be dumped anyway.
Use case: I want to parse module files from packages from hackage with
haskell-src-exts but find it prohibitively difficult to get the preprocessing right. The idea is that after
cabal install with ghc options
-ddump-preprocessed -ddump-to-file -dumpdir real_modules you get a complete working set of haskell modules that can be parsed directly without any preprocessing in folder