DeriveFunctor should not require a functor instance for functorial data types used invariantly
This program:
{-# LANGUAGE DeriveFunctor #-}
data Silly a = Sillly a
data Baz o = Baz {
foo :: o,
bar :: Silly ()
} deriving (Functor)
Produces this error:
/Users/mbolingbroke/Junk/Repro2.hs:7:14:
No instance for (Functor Silly)
arising from the 'deriving' clause of a data type declaration
at /Users/mbolingbroke/Junk/Repro2.hs:7:14-20
Possible fix:
add an instance declaration for (Functor Silly)
or use a standalone 'deriving instance' declaration instead,
so you can specify the instance context yourself
When deriving the instance for (Functor Baz)
But there is absolutely no need for such an instance, because I'm not using "Silly a", just "Silly ()".
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |