id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2604,"Suggest -XDeriveDataTypeable with ""newtype"" too",kaol,,"I'm forwarding wishlist bug [http://bugs.debian.org/499216 #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'
}}}",feature request,closed,normal,,Compiler,6.8.2,fixed,,,Unknown/Multiple,Unknown/Multiple,,Unknown,deriving/should_fail/T2604,,,
