<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Interesting problem & solution.</div><div class=""><br class=""></div><div class="">Here's a wacky idea, from a position of utter ignorance about your environment: could you use color? Already, when I saw `b :: a` in the commentary there, where `b` is in scope as a type variable, it seemed wrong to me.</div><div class=""><br class=""></div><div class="">In any case, I can answer your simpler question: yes, with some work, you can get from a tyvar to its provenance. A tyvar's Name will have its binding location in it. If you also keep track of binding locations as you spot foralls, you should be able to match them up. In theory.</div><div class=""><br class=""></div><div class="">Richard</div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 19, 2016, at 7:45 AM, Christopher Done <<a href="mailto:chrisdone@gmail.com" class="">chrisdone@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">We've encountered a problem in Intero which is that when inspecting types of expressions and patterns, sometimes it happens that the type, when pretty printing, yields variables of the same name but which have different provenance.<div class=""><br class=""></div><div class="">Here's a summary of the issue:<br class=""><div class=""><br class=""></div><div class=""><a href="https://github.com/commercialhaskell/intero/issues/280#issuecomment-254784904" target="_blank" class="">https://github.com/<wbr class="">commercialhaskell/intero/<wbr class="">issues/280#issuecomment-<wbr class="">254784904</a><br class=""></div></div><div class=""><br class=""></div><div class="">And a strawman proposal of how it could be solved:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/commercialhaskell/intero/issues/280#issuecomment-254787927" target="_blank" class="">https://github.com/<wbr class="">commercialhaskell/intero/<wbr class="">issues/280#issuecomment-<wbr class="">254787927</a><br class=""></div><div class=""><br class=""></div><div class="">What do you think? </div><div class=""><br class=""></div><div class="">Also, if I were to implement the strawman proposal, is it possible to recover from a `tyvar :: Type` its original quantification/its "forall"? I've had a look through the API briefly and it looks like a _maybe_.</div><div class=""><br class=""></div><div class="">Ciao!</div></div>
_______________________________________________<br class="">ghc-devs mailing list<br class=""><a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<br class=""></div></blockquote></div><br class=""></body></html>