Skip to content

deriving Data.Typeable on phantom newtypes does not report that DeriveDataTypeable is needed

newtype Foo x = Foo deriving (Typeable)

reports the rather cryptic error message:

Can't make a derived instance of Typeable (Foo x)' (even with cunning newtype deriving:) In the newtype declaration for Foo'

When newtype is replaced with data, this much more useful error message is given:

Can't make a derived instance of Typeable (Foo x)' (You need -XDeriveDataTypeable to derive an instance for this class) In the data type declaration for Foo'

Trac metadata
Trac field Value
Version 6.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information