Skip to content
  • Simon Peyton Jones's avatar
    Fix another bug in deriving( Data ) for data families; Trac #4896 · 863854a3
    Simon Peyton Jones authored
    If we have
    
       data family D a
       data instance D (a,b,c) = ... deriving( Data )
    
    then we want to generate
    
       instance ... => Data (D (a,b,c)) where
         ...
         dataCast1 x = gcast1 x
    
    The "1" here comes from the kind of D.  But the kind of the
    *representation* TyCon is
    
       data Drep a b c = ....
    
    ie Drep :: * -> * -> * -> *
    
    So we must look for the *family* TyCon in this (rather horrible)
    dataCast1 / dataCast2 binding.
    863854a3