How to best display type variables with the same name

Alan & Kim Zimmerman alan.zimm at gmail.com
Wed Oct 19 13:05:14 UTC 2016


This sounds like a thing that should be in the GHC API (the tyvar to
provenance lookup).

Alan

On Wed, Oct 19, 2016 at 2:48 PM, Richard Eisenberg <rae at cs.brynmawr.edu>
wrote:

> Interesting problem & solution.
>
> 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.
>
> 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.
>
> Richard
>
> On Oct 19, 2016, at 7:45 AM, Christopher Done <chrisdone at gmail.com> wrote:
>
> 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.
>
> Here's a summary of the issue:
>
> https://github.com/commercialhaskell/intero/issues/280#
> issuecomment-254784904
>
> And a strawman proposal of how it could be solved:
>
> https://github.com/commercialhaskell/intero/issues/280#
> issuecomment-254787927
>
> What do you think?
>
> 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_.
>
> Ciao!
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
>
>
> _______________________________________________
> 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/20161019/d3c60e10/attachment.html>


More information about the ghc-devs mailing list