Skip to content

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 real_modules.

Trac metadata
Trac field Value
Version 7.10.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Driver
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information