#4896: Deriving Data does not work for attached code
---------------------------------+------------------------------------------
    Reporter:  mitar             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.1         
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------
Changes (by simonpj):

 * cc: jpm@…, andres@… (added)


Comment:

 I had a quick look.  The `Data`/`Typeable` instances for type families
 make my head hurt badly.

 Two facts.  Currently GHC generates a `Data` instance looking like this
 {{{
 instance (Typeable (Bar (D a b)), Data a, Data b) => Data (Bar (D a b))
     where
       dataCast2 f = gcast2 f
 }}}
 That fails. But it passes if we said `dataCast1 f = gcast1 f`.

 Secondly, we are generating too many `Typeable` instances.  If you try
 {{{
 instance Foo (D a b) where
   data Bar (D a b) = B deriving( Typeable )

 instance Foo [a] where
   data Bar [a] = C deriving( Typeable )
 }}}
 you get
 {{{
     Duplicate instance declarations:
       instance Typeable1 Bar -- Defined at T4896.hs:36:34-41
       instance Typeable1 Bar -- Defined at T4896.hs:39:30-37
 }}}
 I'd like someone to work out a clear story for what should happen for
 `Data` and `Typeable` instances for `data` families.  Then I could
 implement it.  Pedro perhaps?  Or Andres?

 Simon

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