posable: A product-of-sums generics library

[ bsd3, generics, library ] [ Propose Tags ] [ Report a vulnerability ]

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.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 1.0.0.0, 1.0.0.1
Change log CHANGELOG.md
Dependencies base (>=4.12.0 && <4.17), finite-typelits (>=0.1.4 && <0.2), generics-sop (>=0.4.0 && <0.6), ghc-typelits-knownnat (>=0.6 && <0.8), template-haskell (>=2.13.0 && <2.19) [details]
Tested with ghc >=8.10
License BSD-3-Clause
Author Rick van Hoef
Maintainer Rick van Hoef <hackage@rickvanhoef.nl>
Category Generics
Home page https://github.com/Riscky/posable
Bug tracker https://github.com/Riscky/posable/issues
Source repo head: git clone https://github.com/Riscky/posable
Uploaded by riscky at 2022-06-16T13:46:53Z
Distributions
Downloads 151 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-06-16 [all 1 reports]

Readme for posable-1.0.0.1

[back to package description]

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 and hlint (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.