Adding a way to reduce type families in type errors

Richard Eisenberg rae at
Mon Nov 23 03:54:46 UTC 2020

> On Nov 21, 2020, at 10:38 PM, Jakob Brünker <jakob.bruenker at> wrote:
> Three questions:
>  - Is there already a way to do this that I'm missing?

Not that I'm aware of. GHC sometimes expands type families and sometimes doesn't. The general philosophy has been that expanding type families is usually good and expanding type synonyms is usually bad. But it wouldn't surprise me in the slightest if GHC is inconsistent about this.

>  - Are there reasons for why this would be a bad idea?

If we did it unconditionally, I imagine some error messages would get worse. Adding a new flag would make the interface to GHC more complex, but perhaps it's worth it.

>  - Would a proposal be necessary for this?

For me, it would depend on the invasiveness of the change; however, making type families expand is already what we try to do, so probably not.

But before blazing ahead, you may want to know that my !4149 already prints what you want. Testing your example yields

Scratch.hs:32:52: error:
    • Couldn't match kind ‘()’ with ‘Maybe String’
      Expected kind ‘Maybe (Foo Int)’, but ‘'()’ has kind ‘()’
    • In the type ‘'()’
      In the type family declaration for ‘Bar’

which I imagine is acceptable.


> Thanks,
> Jakob
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list