Show instances for GHC internals
Alan & Kim Zimmerman
alan.zimm at gmail.com
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 gmail.com>
> 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,
> 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(http://hackage.haskell.org/package/CoreDump), Outputable
> instance of CoreSyn is simply not useful for some things. Similarly, just
> 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)
> by printing things, I think we should provide Show instances for..
> everything. Otherwise I just can't see a way of debugging things and
> 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/build.mk?
> ghc-devs mailing list
> ghc-devs at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs