instantiating visible parameters in when deriving instances

Richard Eisenberg eir at
Mon Mar 28 12:55:16 UTC 2016

Hi devs,

Consider the following:

> data Proxy k (a :: k) = P
>   deriving Functor

What should happen when this is compiled?
 1. Issue an error saying that `deriving` cannot instantiate visible parameters.
 2. Type error: cannot match `k` with `*`.
 3. Successfully produce `instance (Proxy *)`.

Currently, GHC does #3. But this ends up choosing a value for a visible (i.e. explicit) parameter to Proxy. Is this a good idea? I myself have flip-flopped on this issue; see, comments 4 and 9.

I'd love to get feedback on this point.


More information about the ghc-devs mailing list