<div dir="ltr"><div><br>This is a utility I would love to see inside the ghc source tree for examining the AST<br><br><a href="https://github.com/edsko/ghc-dump-tree">https://github.com/edsko/ghc-dump-tree</a><br><br></div>Alan<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 19, 2015 at 11:18 PM, Ömer Sinan Ağacan <span dir="ltr"><<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently the only way to debug and inspect GHC internals is by adding some<br>
carefully placed print statements. (I'd love to be proven wrong on this, cost<br>
of debugging this way is huge, given how long it's taking to rebuild GHC)<br>
<br>
We have Outputable instances for most data types, and `Outputable.pprTrace`<br>
etc. helps with debugging/inspecting pure functions this way.<br>
<br>
However, Outputable instances are hiding some details and they're sometimes not<br>
useful for debugging and inspecting internals. This is why I implemented<br>
CoreDump package(<a href="http://hackage.haskell.org/package/CoreDump" rel="noreferrer" target="_blank">http://hackage.haskell.org/package/CoreDump</a>), Outputable<br>
instance of CoreSyn is simply not useful for some things. Similarly, just today<br>
I had to add a show function for `HscTypes.TargetId` because `Outputable`<br>
instance was hiding `Maybe Phase` field.<br>
<br>
Since the only way to debug or inspect GHC internals(except maybe the RTS) is<br>
by printing things, I think we should provide Show instances for.. basically<br>
everything. Otherwise I just can't see a way of debugging things and inspecting<br>
internals, tracing code etc. for learning purposes.<br>
<br>
I was wondering what would be the cost of adding Show instances. Would that<br>
mean significantly increased compile times? Or significantly bigger GHC<br>
binaries? If that's the case, could we enable Show instances with some<br>
arguments so that we can enable/disable it by modifying mk/<a href="http://build.mk" rel="noreferrer" target="_blank">build.mk</a>?<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div><br></div></div></div>