Skip to content

Suggest -XDeriveDataTypeable with "newtype" too

I'm forwarding wishlist bug #499216 from Debian's BTS.


If I try to compile or load this program, ghc complains that I need to pass -XDeriveDataTypeable to enable the derivation of Typeable instances:

------ begin Test.hs --------
module Test where

import Data.Typeable

data List a = List [a] deriving(Typeable)
-----------------------------
Test.hs:5:0:
    Can't make a derived instance of `Typeable (List a)'
      (You need -XDeriveDataTypeable to derive an instance for this class)
    In the data type declaration for `List'

If I use "newtype" and I have GeneralizedNewtypeDeriving turned on, however, I get this error:

/tmp/Test.hs:5:0:
    Can't make a derived instance of `Typeable (List a)'
      (even with cunning newtype deriving:)
    In the newtype declaration for `List'

It would be nice if ghc suggested DeriveDataTypeable here too. JFTR, it does suggest this if newtype deriving is off:

/tmp/Test.hs:5:0:
    Can't make a derived instance of `Typeable (List a)'
      (You need -XDeriveDataTypeable to derive an instance for this class
       Try -XGeneralizedNewtypeDeriving for GHC's newtype-deriving extension)
    In the newtype declaration for `List'
Trac metadata
Trac field Value
Version 6.8.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information