GHC Core question

Tim Chevalier catamorphism at
Mon Jan 7 15:01:15 EST 2008

On 1/7/08, Neil Mitchell <ndmitchell at> wrote:
> Hi
> > How are you printing out the Core?
> showSDoc $ ppr c
> where c :: [CoreBind]
> > It looks like the unique ids are
> > missing (you can see them if you pass the -ppr-debug flag, which can
> > be set using the API)
> I have now set the -ppr-debug flag, but that has no effect. It's not
> entirely surprising, as I guess setting the flag only applies through
> the GHC session, and this code is being run outside that. How can I
> print the output (to a file) using the unique id's?

Good point about the session, I forgot about that. It looks like you
can call showSDocDebug instead of showSDoc (see utils/Outputable.lhs),
which acts as if -dppr-debug is set, but I haven't actually tried it.

> Can I invoke CoreTidy using the GHC API?

Yes, but you'll need to grab a post-Dec-25 build if you haven't
already, since I added this recently. Once you have, see
compileToCoreSimplified in main/GHC.hs.


Tim Chevalier * * Often in error, never in doubt
"It's easy to consider women more emotional than men when you don't
consider rage to be an emotion." -- Brenda Fine

More information about the Glasgow-haskell-users mailing list