
#8516: Add (->) representation and the Invariant class to GHC.Generics -------------------------------------+------------------------------------- Reporter: nfrisby | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler (Type | Version: 7.7 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I really like the idea of adding `(:->:)` to `GHC.Generics`. One of my biggest gripes with `deriving Generic1` is that it doesn't work with many data types that have function arguments (e.g., `Endo`). I think adding `(:->:)` would allow GHC generics to at least be as expressive as `DeriveFunctor`/`Foldable`/`Traversable`. I'm a bit hesitant about adding `Invariant` to `base`, however, primarily because I find it unlikely that it would ever be made a superclass of `Functor`, given the sheer amount of breakage that would cause. Moreover, I don't think we need `Invariant` to be able to derive `Generic1` for data types with `(:->:)`. I believe at most a generated `Generic1` instance would need some `Functor` constraints, but that's no different than the current story. (I haven't worked out the additional rules you'd need to add to the algorithms in Figures 1-4 of http://dreixel.net/research/pdf/gdmh.pdf, but the examples I've worked out by hand so far have only needed `Functor` constraints.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8516#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler