The origami package
This package provides a framework for transforming heterogenous data in a typed manner using folds and provides Template Haskell macros for automatically producing the necessary boilerplate.
Given a set of datatypes, we generate a record declaration called Fold, parameterized over one type variable for each datatype. For each constructor Xxx used by any of these types, a field mkXxx is generated. (A few utility Fold values are additionally defined.)
For each datatype Yyy, we also generate a foldYyy function that applies a Fold to its Yyy argument, resulting in a yyy value. Conceptually, any constructor Xxx in the argument or any of its sub-components is recursively replaced bottom-up by an application of mkXxx.
The set of datatypes, the fold family, is specified by giving a list of root datatypes. Datatypes may be designated as atomic: they will not be recursed into.
In general, the framework does not handle parameterized datatypes, but applications of Traversable, Bitraversable, or Tritraversable can be handled, if declared by the user. The n-ary functors are treated as transparent and traversed through.
See the website for more information and examples.
|Versions||0.0.1, 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6|
|Dependencies||base (==4.*), bifunctors (==4.2.*), containers (==0.5.*), lens (==4.7.*), mtl (==2.1.*), pretty (==1.1.*), template-haskell [details]|
|Copyright||(c) 2015 Eric Nedervold|
|Source repository||head: git clone git://github.com/nedervold/origami.git|
|Uploaded||Sun Feb 8 02:53:19 UTC 2015 by nedervold|
For package maintainers and hackage trustees