How to best display type variables with the same name

Simon Peyton Jones simonpj at microsoft.com
Wed Oct 19 16:00:54 UTC 2016


I’m afraid I didn’t understand the issue in the link below.  It speaks of “querying the type”, but I’m not sure what that means.  A GHCi session perhaps?  Does this relate to the way GHCi displays types?

I’m a bit lost.  A from-the-beginning example, showing steps and what the unexpected behaviour is would be helpful (to me anyway)

Simon

From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Christopher Done
Sent: 19 October 2016 12:46
To: ghc-devs at haskell.org
Subject: How to best display type variables with the same name

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<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcommercialhaskell%2Fintero%2Fissues%2F280%23issuecomment-254784904&data=02%7C01%7Csimonpj%40microsoft.com%7C58538b7f7532497970c708d3f8158e45%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636124743872989785&sdata=2AkHss5Io%2BHqJjF8CtFwSErBuUca6N2gJ3DELC03nFY%3D&reserved=0>

And a strawman proposal of how it could be solved:

https://github.com/commercialhaskell/intero/issues/280#issuecomment-254787927<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcommercialhaskell%2Fintero%2Fissues%2F280%23issuecomment-254787927&data=02%7C01%7Csimonpj%40microsoft.com%7C58538b7f7532497970c708d3f8158e45%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636124743872989785&sdata=ev%2FJQg4xKrZVyi0uP9PxS756t41IO4%2BoI0AlJoT9F7U%3D&reserved=0>

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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161019/030776fe/attachment-0001.html>


More information about the ghc-devs mailing list