[GHC] #8599: Deriving in associated data families

GHC ghc-devs at haskell.org
Sat Dec 7 12:13:35 UTC 2013


#8599: Deriving in associated data families
------------------------------------+-------------------------------------
       Reporter:  mojojojo          |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Compiler          |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 This code
 {{{
 class Class a where
   data DF a

 data family DF' a

 instance (Eq (DF' a)) => Class a where
   newtype DF a = DF (DF' a) deriving (Eq)
 }}}

 fails with

 {{{
 No instance for (Eq (DF' a))
     arising from the 'deriving' clause of a data type declaration
   Possible fix:
     add an instance declaration for (Eq (DF' a))
     or use a standalone 'deriving instance' declaration,
          so you can specify the instance context yourself
   When deriving the instance for (Eq (DF a))
 }}}

 The following way it compiles fine, however
 {{{
 class Class a where
   data DF a

 data family DF' a

 instance Class a where
   newtype DF a = DF (DF' a)

 deriving instance (Eq (DF' a)) => Eq (DF a)
 }}}

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


More information about the ghc-tickets mailing list