instantiating visible parameters in when deriving instances
eric at seidel.io
Mon Mar 28 13:42:38 UTC 2016
I'm inclined to go with option 3 as `Functor (Proxy *)` is the only
instance that would typecheck.
Perhaps with a warning to let the user know the instance is less general
than they might expect? I think this is the most user-friendly route:
the user can suppress the warning if they don't care, or make it an
error if they do care.
On Mon, Mar 28, 2016, at 05:55, Richard Eisenberg wrote:
> 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
> 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
> https://ghc.haskell.org/trac/ghc/ticket/11732, comments 4 and 9.
> I'd love to get feedback on this point.
> ghc-devs mailing list
> ghc-devs at haskell.org
More information about the ghc-devs