#5863: Deriving Typeable for data families
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.4.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
 Bas points out that `deriving Typeable` for data families isn't right at
 all.
 {{{
 {-# LANGUAGE DeriveDataTypeable, TypeFamilies #-}

 import Data.Typeable

 class C a where
     data T a :: *

 instance C Int where
     data T Int = A1 deriving (Typeable)

 instance C Bool where
     data T Bool = A2 deriving (Typeable)
 }}}
 gives this error:
 {{{
 TF_Data.hs:12:34:
     Duplicate instance declarations:
       instance Typeable1 T -- Defined at TF_Data.hs:12:34
       instance Typeable1 T -- Defined at TF_Data.hs:15:34
 }}}
 The real problem is that we should have only one instance for `Typeable
 T`.  We should only allow
 {{{
 deriving instance Typeable1 T
 }}}
 and prohibit `deriving Typeable` on `data instance` declarations.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5863>
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