#2604: Suggest -XDeriveDataTypeable with "newtype" too
--------------------------------+-------------------------------------------
    Reporter:  kaol             |       Owner:          
        Type:  feature request  |      Status:  new     
    Priority:  normal           |   Component:  Compiler
     Version:  6.8.2            |    Severity:  trivial 
    Keywords:                   |    Testcase:          
Architecture:  Unknown          |          Os:  Unknown 
--------------------------------+-------------------------------------------
 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'
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2604>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to