The shapely-data package

[Tags: bsd3, library]

shapely-data is a library for working with algebraic datatypes in a simple generic form made up of haskell's primitive product, sum and unit types: `(,)`, Either, and `()`, providing something like light-weight Structural Typing.

The library was not designed to facilitate generic traversals or abstraction over different recursion schemes, but rather to (from most to least important)

Influences

I've taken lots of inspiration, code, names, ideas, and type-level programming techniques from, in particular

Issues and Limitations:


[Skip to ReadMe]

Properties

Versions0.0, 0.1
Change logNone available
Dependenciesbase (<5), proxy-kindness (==0.1), tagged, template-haskell (==2.*) [details]
LicenseBSD3
AuthorBrandon Simmons
Maintainerbrandon.m.simmons@gmail.com
CategoryData, Generics
Home pagehttp://github.com/jberryman/shapely-data
Source repositoryhead: git clone https://github.com/jberryman/shapely-data.git -b master
UploadedSun Dec 22 23:32:01 UTC 2013 by BrandonSimmons
Downloads353 total (15 in last 30 days)
Votes
0 []
StatusDocs available [build log]
Successful builds reported [all 1 reports]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for shapely-data-0.1

shapely-data is a haskell library up here on hackage for working with algebraic datatypes in a simple generic form made up of haskell's primitive product, sum and unit types: (,), Either, and ().

You can install it with

cabal install shapely-data

Motivation and examples

In order from most to least important to me, here are the concerns that motivated the library:

Lowest on the list is supporting abstracting over different recursion schemes or supporting generic traversals and folds, though some basic support is planned.

Finally, in at least some cases this can completely replace GHC.Generics and may be a bit simpler. See examples/Generics.hs for an example of the GHC.Generics wiki example ported to shapely-data. And for a nice view on the changes that were required, do:

git show 3a65e95 | perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight

Why not GHC.Generics?

The GHC.Generics representation has a lot of metadata and a complex structure that can be useful in deriving default instances; more important to us is to have a simple, canonical representation such that two types that differ only in constructor names can be expected to have identical generic representations.

This supports APIs that are type-agnostic (e.g. a database library that returns a generic Product, convertible later with to), and allows us to define algebraic operations and composition & conversion functions.