[GHC] #9043: Add missing type class instances for data types in GHC.Generics

GHC ghc-devs at haskell.org
Sun Apr 27 22:08:30 UTC 2014


#9043: Add missing type class instances for data types in GHC.Generics
-------------------------------------+------------------------------------
        Reporter:  ocharles          |            Owner:  ocharles
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  libraries/base    |          Version:  7.8.2
      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 ekmett):

 Makes a lot of sense to me.

 The missing `Functor`/`Foldable`/`Traversable` instances for these have
 bitten me before and the instances are entirely determined by their laws /
 convention.


 There are a few other instances that make sense uniformly:

 e.g. `U1`, `Par1`, `Rec1`, and `(:*:)`, and `M1` can also be made
 instances of `Applicative`, `Monad`, `MonadZip` in a completely
 unambiguous way determined by the laws just by lifting them from their
 parts.

 `(:.:)` admits an unambiguous `Applicative`, but not the others.

 It might also make sense to look into making the types in there instances
 of `Generic` / `Generic1` for bootstrapping purposes, and they are
 currently missing `Typeable` and `Data` instances as well.

 The instances probably have to live out mostly where the typeclasses come
 from rather than in the module itself to avoid cycles, but otherwise I
 don't see any headaches, and they are entirely determined by the
 definitions of the classes involved, so there is no bikeshedding
 opportunity.

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


More information about the ghc-tickets mailing list