Misleading error message when deriving Functor
Compiling this trivial demo program:
data Container
= Container [Wibble Int]
deriving (Eq, Show)
data Wibble a
= Wibble a
| Wobble
deriving (Eq, Functor, Show)
results in the error message:
a.hs:6:13: error:
• No instance for (Eq (Wibble Int))
arising from the first field of ‘Container’ (type ‘[Wibble Int]’)
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
• When deriving the instance for (Eq Container)
a.hs:6:17: error:
• No instance for (Show (Wibble Int))
arising from the first field of ‘Container’ (type ‘[Wibble Int]’)
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
• When deriving the instance for (Show Container)
a.hs:12:17: error:
• Can't make a derived instance of ‘Functor Wibble’:
You need DeriveFunctor to derive an instance for this class
• In the data declaration for ‘Wibble’
The "No instance for (Eq|Show)" are rather misleading, because the *actual* error is that the {-# LANGUAGE DeriveFunctor #-}
pragma is missing.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |