generics-sop
is a library to support the definition of generic functions.
Datatypes are viewed in a uniform, structured way: the choice between
constructors is represented using an n-ary sum, and the arguments of each
constructor are represented using an n-ary product.
Since version 0.4.0.0, generics-sop
is now based on sop-core
. The core
package contains all the functionality of n-ary sums and products, whereas
generics-sop
provides the datatype-generic programming support on top.
This is the development repository for the packages. For releases, look on Hackage.
The module Generics.SOP
is the main module of this library
and contains more detailed documentation.
Examples of using generics-sop
are provided by the following
packages:
- basic-sop basic examples,
- pretty-sop generic pretty printing,
- lens-sop generically computed lenses,
- json-sop generic JSON conversions.
A detailed description of the ideas behind this library is provided by the paper:
- Edsko de Vries and Andres Löh. True Sums of Products. Workshop on Generic Programming (WGP) 2014.