
#8624: -ddump-splices-file -------------------------------------+------------------------------------ Reporter: GregWeber | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by simonpj): This seems like a very reasonable thing to do. I'm not volunteering to do it myself, but I'll gladly support anyone who does; I know how the TH implementation works. The "untyped" splices are expanded by the renamer, and the "typed" ones by the type checker. So if you want to see all splices expanded, you need to look at the output of the type checker. Fortunately that's not difficult: it is more or less what `-ddump-tc` shows you. So to a first approximation, what you want is to take the output of `-ddump-tc` and put it in a file. But there are always details: * `-ddump-tc` is, as its name implies, a debugging flag. We have not taken care to ensure that the pretty-printed output is fully-parsable Haskell. It should be, but you'd need to work on the `Outputable` instances for `HsSyn` to make it fully working. * The type checker "elaborates" the code by adding type abstractions and applications, dictionary abstractions and applications, and so on. For debugging purposes you want to see this; but for your purposes you want to suppress all the elaboration stuff. I've been careful to use different data constructors in `HsSyn` for elaboration code, so it should be easy to suppress it. But to do that you need to pass a flag into the pretty printer (to tell it whether to suppress it) and we need to think about how to do that. You definitely don't want to write two pretty-printers! The usual process is to start a GHC Trac wiki page to describe the (user- facing) specification, and sketch any implementation details or choices. And use the ticket or `ghc-devs` to discuss. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8624#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler