[GHC] #9999: Typeable deriving behavior different between data families and associated data types

GHC ghc-devs at haskell.org
Fri Jan 16 17:28:26 UTC 2015


#9999: Typeable deriving behavior different between data families and associated
data types
-------------------------------------+-------------------------------------
              Reporter:  shachaf     |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.8.4
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 With `AutoDeriveTypeable`, data families get a `Typeable` instance, but
 associated data types in a class don't (and even standalone deriving
 doesn't work for them).

 {{{
 λ> data family Foo a
 λ> typeRep (Proxy :: Proxy Foo)
 Foo
 λ> class K a where { data Bar a }
 λ> typeRep (Proxy :: Proxy Bar)

 <interactive>:6:1:
     No instance for (Typeable Bar) arising from a use of ‘typeRep’
     In the expression: typeRep (Proxy :: Proxy Bar)
     In an equation for ‘it’: it = typeRep (Proxy :: Proxy Bar)
 λ> deriving instance Typeable Bar

 <interactive>:7:1:
     Can't make a derived instance of ‘Typeable Bar’:
       Deriving Typeable is not allowed for family instances;
       derive Typeable for ‘Bar’ alone
     In the stand-alone deriving instance for ‘Typeable Bar’
 }}}

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


More information about the ghc-tickets mailing list