expanding type synonyms in error messages

Ömer Sinan Ağacan omeragacan at gmail.com
Tue Jun 16 15:20:51 UTC 2015

Hi all,

While working with complex types with lots of arguments etc. errors are
becoming annoying very fast. For example, GHC prints errors in this way:

    Expected type: <type without any synonyms>
      Actual type: <type with synonyms>

Now I have to expand that synonym in my head to understand the error.

I was wondering if implementing something like this is possible:

In type error messages, GHC also prints types that are cleaned from type
synonyms. Maybe something like this:

         Expected type: <type1>
    (without synonyms): <type1, synonyms are expanded>
           Actual type: <type2>
    (without synonyms): <type2, synonyms are expanded>

If this is not always desirable for some reason, we can hide this behavior
behind a flag.

What do GHC devs think about this? Is this, in theory, possible to do? How hard
would it be to implement this?


More information about the ghc-devs mailing list