How to best display type variables with the same name

Christopher Done chrisdone at gmail.com
Thu Oct 27 09:35:47 UTC 2016


On 26 October 2016 at 11:43, Simon Peyton Jones <simonpj at microsoft.com> wrote:
> As far as I understand it:
>
> ·         You are plucking a type from the midst of a syntax tree, and
> displaying it.
>
> ·         That type might well mention type variables that are bound
> “further out”
>
> o   either by a forall (if this is a sub-tree of a type)
>
> o   or by a big lambda
>
> ·         There are some tricky UI issues in how to display such types to
> the user.

Right.

> Generally, I think it’s mainly up to you to track which type variables are
> in scope from “further out”.  It’s not a property that is stable under
> transformation, so it’s not part of the TyVar.

Fair enough. That's useful to know, thanks. In that case I can explore
alternative approaches.

> The typechecker itself uses “tidying” to avoid accidentally displaying
> distinct type variables in the same way.  See TyCoRep.tidyType and related
> functions.  They may be useful to you too.

Ah, the TidyEnv makes sense to me. I think that'll come in handy to
review the code to make sure I don't miss anything.

> Hard for me to say more… I’m swamped, and there are genuine UI issues here.
> Maybe some folk on Haskell Café might be interested.

Thanks! I've also got low bandwidth for this, I just posted it to have
it out there, as it probably requires some brewing before anything
will be implemented anyway.


More information about the ghc-devs mailing list