equality relations: user-facing pretty-printing question

Ryan Scott ryan.gl.scott at gmail.com
Mon Jan 18 17:24:17 UTC 2016

In my ideal world, GHC would remember as much as what the user wrote
as possible in printing error messages. So if the user writes:

    f :: Int ~ Char => ...

Then GHC would remember that the context was written with a single
tilde, and print out Int ~ Char in the error message explicitly
wherever the full type signature of f is printed.

What it sounds like, though, is that deep in the guts of the type
inferencer, there's a chance that single-tilde equality might turn
into double-tilde or tilde-hash equality at some point. In those
cases, printing out the particular brand of tilde might get confusing.
In such cases, we might compromise and print out something neutral
like "is equal to". I suppose this would always be the case if you
didn't explicitly write a ~ b and had to infer it.

I'm not sure about the technical details of this though, i.e., if GHC
actually remembers a ~ b all the way through the
typechecking/inferencing pipeline.

Ryan S.

More information about the ghc-devs mailing list