A product-of-sums generics library.
A generics library that represents a non-recursive Haskell 98 datatype as a product-of-sums. Each type is represented with a single tag, and a product of sums of fields. The tag represents all constructor choices in the type, the fields contain all the values in the type. This representation maps easily to a struct of unions, which is a memory-efficient way to store sum datatypes.
POSable
A library to convert non-recursive Haskell-98 datatypes to a Product-of-Sums representation - and back. This makes it possible to compactly store arrays of (nested) sum types in a struct-of-arrays representation, which is used in array-based languages like Accelerate.
Dependencies
- The Stack package manager (Tested with stack 2.7.3)
stylish-haskell
andhlint
(for linting only)
Tests and lints
stylish-haskell -r src examples test
hlint src examples test
stack test
Building
stack build
# To build the docs
stack haddock posable
Examples
In the examples folder you will find examples that describe how to use this library.