generic-data: Utilities for GHC.Generics

[ deriving, library, mit, other ] [ Propose Tags ]

This package provides common functions on generic types. See README.

[Skip to Readme]
Versions [faq],,,,,,,,,,
Dependencies base (>=4.9 && <4.12), contravariant, show-combinators [details]
License MIT
Copyright 2018 Li-yao Xia
Author Li-yao Xia
Revised Revision 1 made by HerbertValerioRiedel at Wed Oct 10 20:33:44 UTC 2018
Category Other
Home page
Source repo head: git clone
Uploaded by lyxia at Wed Mar 28 04:02:42 UTC 2018
Distributions Arch:, LTSHaskell:, NixOS:, Stackage:
Downloads 3174 total (601 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-03-28 [all 1 reports]




Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Readme for generic-data-

[back to package description]

Generic data types in Haskell Build Status

Utilities for GHC.Generics.

Generic deriving for standard classes

Supported classes that GHC currently can't derive: Semigroup, Monoid, Applicative, Alternative, Eq1, Ord1, Show1.

Other classes from base are also supported, even though GHC can already derive them:

  • Eq, Ord, Enum, Bounded, Show (standard);
  • Functor, Foldable, Traversable (via extensions, DeriveFunctor, etc.).

To derive type classes defined elsewhere, it might be worth taking a look at one-liner.

Type metadata

Extract type names, constructor names, number and arities of constructors, etc..

Related links

generic-data aims to subsume the following packages, which may still be useful for old versions of GHC and base not supported by generic-data.

  • semigroups: generic Semigroup, Monoid.
  • transformers-compat: generic Eq1, Ord1, Show1, Read1.
  • generic-deriving: doesn't derive the classes in base (defines clones of these classes as a toy example); has Template Haskell code to derive Generic.

Here are other relevant links.

  • deriving-compat: deriving with Template Haskell.
  • one-liner: another approach to using GHC.Generics to derive instances of many type classes, including but not restricted to the above classes (this is done in one-liner-instances).
  • singletons: generic-data borrows code from this package to implement defunctionalization.

All contributions are welcome. Open an issue or a pull request on Github!