[GHC] #3707: deriving Data, Typeable for empty data decls

GHC trac at galois.com
Mon Nov 30 13:07:40 EST 2009


#3707: deriving Data, Typeable for empty data decls
---------------------------------+------------------------------------------
    Reporter:  seanmcl           |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.10.4            |    Keywords:              
          Os:  Unknown/Multiple  |    Testcase:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 Empty data decls are useful for things like phantom types.  However,
 deriving (Data, Typeable) does not work with them, so if you want to use
 them with generics you must do something like the following:

 data PredTag

 instance Typeable PredTag where
   typeOf _ = G.mkTyConApp (G.mkTyCon "PredTag") []

 Surely GHC could derive this for us!

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3707>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list