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

https://github.com/edsko/ghc-dump-tree

Alan

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

> 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(http://hackage.haskell.org/package/CoreDump), 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/build.mk?
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151019/9ae15b1c/attachment-0001.html>


More information about the ghc-devs mailing list