Generic deriving for standard classes
Supported classes that GHC currently can’t derive:
Other classes from base are also supported, even though GHC can already derive them:
Read is currently not implemented.)
To derive type classes defined elsewhere, it might be worth taking a look at one-liner.
Extract type names, constructor names, number and arities of constructors, etc..
generic-data aims to subsume generic deriving features of the following packages:
- semigroups: generic
Monoid, but with a heavy dependency footprint.
doesn’t derive the classes in base (defines clones of these classes as a toy
example); has Template Haskell code to derive
Here are other relevant links.
- deriving-compat: deriving with Template Haskell.
- one-liner: another approach
GHC.Genericsto derive instances of many type classes, including but not restricted to the above classes (this is done in one-liner-instances).
- singletons, first-class-families (second one written by me) libraries for dependently-typed programming in Haskell.
All contributions are welcome. Open an issue or a pull request on Github!
- Add generic implementations of
enumFromThenTo. They are actually required to be explicit for correct
Enuminstances. Thanks to Topsii.
GEnumby a type-level option, and add
FiniteEnumoption to allow
Enumto be derived for composite types. Thanks to Topsii.
Defunmodule (subsumed by
- Interface for constructor tags
- Add basic