Show instances for GHC internals

Alan & Kim Zimmerman alan.zimm at
Mon Oct 19 21:26:12 UTC 2015

This is a utility I would love to see inside the ghc source tree for
examining the AST


On Mon, Oct 19, 2015 at 11:18 PM, Ömer Sinan Ağacan <omeragacan at>

> Currently the only way to debug and inspect GHC internals is by adding some
> carefully placed print statements. (I'd love to be proven wrong on this,
> cost
> of debugging this way is huge, given how long it's taking to rebuild GHC)
> We have Outputable instances for most data types, and `Outputable.pprTrace`
> etc. helps with debugging/inspecting pure functions this way.
> However, Outputable instances are hiding some details and they're
> sometimes not
> useful for debugging and inspecting internals. This is why I implemented
> CoreDump package(, Outputable
> instance of CoreSyn is simply not useful for some things. Similarly, just
> today
> I had to add a show function for `HscTypes.TargetId` because `Outputable`
> instance was hiding `Maybe Phase` field.
> Since the only way to debug or inspect GHC internals(except maybe the RTS)
> is
> by printing things, I think we should provide Show instances for..
> basically
> everything. Otherwise I just can't see a way of debugging things and
> inspecting
> internals, tracing code etc. for learning purposes.
> I was wondering what would be the cost of adding Show instances. Would that
> mean significantly increased compile times? Or significantly bigger GHC
> binaries? If that's the case, could we enable Show instances with some
> arguments so that we can enable/disable it by modifying mk/
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list