origami

An un-SYB framework for transforming heterogenous data through folds http://github.com/nedervold/origami

Latest on Hackage:0.0.6

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed and maintained by Eric Nedervold<nedervoldsoftware@gmail.com>

The Origami package consists of a coding pattern for transforming heterogenously typed data and Template Haskell macros to support the pattern. It operates in the same problem space as SYB, but generates the boilerplate for the user.

In the pattern, we focus on a specific set of types, the fold family. For each constructor of each of those types, the user will define a function to "replace" the constructor when folding.

These functions are collected together into a single record. (Its declaration is generated for the user.) Collecting the functions together forces the typing of all the functions to remain consistent and facilitates code reuse.

For each datatype, a fold function is automatically generated that applies the fold record to values of that datatype. It decomposes the value into parts according to its constructor, recursively applies the fold to the parts, then puts them back together using the replacement constructor function from the record.

As with SYB, Origami lets the user think on a higher-level of abstraction about data transformation and relieves her from the need to write boilerplate.

See the website for more information and examples.

Changes

0.0.6 (2015-10-24):
- More code changes to compile under GHC 7.10's new Template Haskell.
0.0.5 (2015-10-23):
- Code changes to compile under GHC 7.10's new Template Haskell.
0.0.4 (2015-04-02):
- Removed upper bounds.
0.0.3 (2015-04-02):
- Relaxing upper bounds.
0.0.2 (2015-02-21):
- Bug fixes.
0.0.1 (2015-02-08):
- Initial version.
comments powered byDisqus