PSA: type checker plugins to be affected by upcoming changes to GHC

Adam Gundry adam at
Thu Nov 19 09:14:30 UTC 2020

Thanks Richard!

I'm happy to see this as I've always felt the flattening story to be
unnecessarily complex for type-checker plugins, and in fact uom-plugin
has been broken for a long time because of a previous GHC change to
flattening skolems.[1,2] I haven't checked but I am moderately hopeful
your work will at least make it easier to fix, if not fix it outright.

As part of removing Deriveds, do you plan to change the type-checker
plugin interface to drop the redundant argument? Although I suppose GHC
could simply pass an empty list to the plugin.

Ideally we would have a spec (or at least some tests!) for what
constraints get presented to plugins. The current implementation is
rather dependent on whatever GHC's solver happens to produce. In my
paper [3] I tried to specify plugins based on the published description
of OutsideIn(X), but that's far enough from the reality of GHC that it
isn't much help in practice. (One point it lacks is any treatment of
Deriveds, so I'm happy to see them go!)




On 19/11/2020 04:45, Ben Gamari wrote:
> Iavor and Christiaan are two plugin authors that come to mind.
> Ideally the patch would also include some migration documentation in the
> release notes.
> Cheers,
> - Ben
> On November 18, 2020 11:20:40 PM EST, Richard Eisenberg
> <rae at> wrote:
>     Hi all,
>     I'm hard at work on two significant refactorings within GHC's constraint solver. The first is at It removes flattening meta-variables and flattening skolems. This is a very nice simplification. Instead, it just reduces type families directly. My other patch (held up by the first) is at and will remove Derived constraints, to be replaced by a little bit of cleverness in suppressing certain confusing error messages. My guess is that either or both of these will invalidate the current behavior of type-checker plugins. Sadly, this is not just a case of finding a new function that replicates the old behavior -- enough is changing under the hood that you might actually have to rewrite chunks of your code.
>     I have never written a type-checker plugin, and so I don't currently have advice for you. But if you are a plugin author affected by this change and want help, please reach out -- I would be happy to walk you through the changes, and then hopefully make a little video explaining the process to other plugin authors.
>     Neither patch will make it for 9.0, but I expect both to be in 9.2. There may be more where this came from ( in the future, but it's all for a good cause.
>     (I have bcc'd plugin authors that I'm aware of. Just adding this in case you're surprised at receiving this email.)
>     Thanks,
>     Richard

Adam Gundry, Haskell Consultant
Well-Typed LLP,

Registered in England & Wales, OC335890
118 Wymering Mansions, Wymering Road, London W9 2NF, England

More information about the ghc-devs mailing list