Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#9999 closed bug (fixed)

Typeable deriving behavior different between data families and associated data types

Reported by: shachaf Owned by: dreixel
Priority: normal Milestone: 7.10.1
Component: Compiler Version: 7.8.4
Keywords: Cc: dreixel
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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)
λ> class K a where { data Bar a }
λ> typeRep (Proxy :: Proxy Bar)

    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

    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’

Change History (8)

comment:1 Changed 4 years ago by simonpj

Cc: dreixel added

Pedro, any comments?

comment:2 Changed 4 years ago by dreixel

With HEAD, the standalone deriving clause works. But AutoDeriveTypeable is indeed not working as it should here.

comment:3 Changed 4 years ago by simonpj

Aha. Might you feel able to fix it?


comment:4 Changed 4 years ago by dreixel

Owner: set to dreixel

comment:5 Changed 4 years ago by Jose Pedro Magalhaes <dreixel@…>

In d839493991e508160d416311ba47b7a7e2d62aae/ghc:

Make AutoDeriveTypeable work for associated datatypes (fix #9999)

comment:6 Changed 4 years ago by thoughtpolice

Milestone: 7.10.1
Status: newmerge

comment:7 Changed 4 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed

Merged to ghc-7.10.

comment:8 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In d3c08ca0c4f83aaed6bd25785a03c0fb52438ba6/ghc:

Tidy up fix to Trac #9999

Minor refactoring only
Note: See TracTickets for help on using tickets.