[GHC] #8950: Typeable instances for promoted lists and tuples

GHC ghc-devs at haskell.org
Fri Apr 4 14:41:54 UTC 2014


#8950: Typeable instances for promoted lists and tuples
-------------------------------------+------------------------------------
        Reporter:  kosmikus          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  libraries/base    |          Version:  7.8.1-rc2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by simonpj):

 OK, well, I got sucked into this and spent a couple of hours refactoring
 `TcDeriv` (again).  Man, if I had a pound for each hour I've spent on
 `deriving`, I'd be a rich bunny.

 Anyway, the design I have implemented is this:
  * If you say `AutoDeriveTypeable`, and you do not manually derive
 `Typeable`, then it's done automatically.

  * If you derive `Typeable` with `DataKinds` enabled, then you also get
 `Typeable` instances for the promoted data constructors.

  * For a data/newtype declared in this module, there is no difference
 between
    * putting `Typeable` in the `deriving` clause on a data type
 declaration
    * using standalone `deriving instance Typeable T`

  * However, standalone `deriving` can also derive `Typeable` for
    * imported types
    * data families

  * `AutoDeriveTypeable` derives `Typeable` for
    * all data/newtypes
    * all data families
    * all classes
    declared in this module.  Indeed `AutoDeriveTypeable` is currently the
 ''only'' way to derive `Typeable` for classes.

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


More information about the ghc-tickets mailing list