<div dir="ltr">> <span style="font-size:12.8px">All the type-checking decisions are around the kinds of the types floating through the system, so look there. You might want to know what type that kind is classifying... perhaps print out the HsType before it's lost.</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">In the problems I'm tackling, I don't care so much about the kind of the TyCon I'm dealing with, but rather its type variables. Alas, I don't know of a good way to inspect the changes that happen to these type variables inside the knot--even printing out the *length* of tyConTyVars would result in an infinite loop!</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">> </span><span style="font-size:12.8px">Or, you could tackle #13737 and get rid of the knot altogether! :)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I didn't know about that ticket, thanks. I had noticed in some of the code I frequently look at (TcGenGenerics, which generates Generic(1) instances) that the generated code uses HsExpr for the generated instance methods, but Type for the generated associated type family instances, which always felt icky to me. Maybe I could start by trying to produce HsType in that particular spot in the code (or does this need to be done all at once?).</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Ryan S.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 4, 2017 at 7:33 AM, Richard Eisenberg <span dir="ltr"><<a href="mailto:rae@cs.brynmawr.edu" target="_blank">rae@cs.brynmawr.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>My secret is that I've been annoyed by this problem, too!</div><div><br></div><div>Perhaps a better answer is that you probably don't need the information you don't have. All the type-checking decisions are around the kinds of the types floating through the system, so look there. You might want to know what type that kind is classifying... perhaps print out the HsType before it's lost.</div><div><br></div><div>Or, you could tackle #13737 and get rid of the knot altogether! :)</div><div><br></div><div>Richard</div><br><div><blockquote type="cite"><div><div class="h5"><div>On Aug 3, 2017, at 6:21 PM, Ryan Scott <<a href="mailto:ryan.gl.scott@gmail.com" target="_blank">ryan.gl.scott@gmail.com</a>> wrote:</div><br class="m_4422143752526355758Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr">Recently, I've found myself wanting to make changes to code that works inside code where TyCons are knot-tied [1]. But I've found myself unable to make much progress, since my ability to debug this code is severely limited by the fact that I can't seem to trace anything. That is, if I try tracing anything that comes from a knot-tied TyCon, GHC will go into an infinite loop! This prevents me from learning *anything* about the types floating around in the code I want to fix, which is hugely annoying.<div><br></div><div>How do others work around this problem? There must be *some* way to glean information about the types inside a typechecker knot, since others seem to be able to work within this space. How do you do it? And will you consider sharing your secrets?<br><div><div><br></div><div>Ryan S.<br><div>-----</div><div>[1] See Note [Type-checking inside the knot] at <a href="http://git.haskell.org/ghc.git/blob/884bd21a917f607b5a44e038e06f78d0b765ea63:/compiler/typecheck/TcHsType.hs#l1087" target="_blank">http://git.haskell.org/ghc.<wbr>git/blob/<wbr>884bd21a917f607b5a44e038e06f78<wbr>d0b765ea63:/compiler/<wbr>typecheck/TcHsType.hs#l1087</a></div></div></div></div></div></div></div>
______________________________<wbr>_________________<br>ghc-devs mailing list<br><a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a><br></div></blockquote></div><br></div></blockquote></div><br></div>