open-adt: Open algebraic data types.
This library, built upon row-types, provides types and functions for variants of various functors that all have the same type applied to them. This is very similar to, and inspired by, haskus-utils-variant. At the time of writing, the compile-time performance of haskus-utils-variant is poor for variants with many fields, which should be improved in this package by using row-types.
The main types of interest in this package are VarF
and
OpenADT
. VarF
wraps a variant of functors, all over the same
type, and provides a functor instance that fmaps over whatever
the variant is. OpenADT
is the fixed-point type of VarF
,
which allows for recursive structures to be created.
A convenience function, mkVarPattern
from Data.OpenADT.TH
,
generates patterns that can be used as constructors for variants.
The key aspect of these patterns is that they are polymorphic
in the type of the row, allowing them to be used as constructors
for any open algebraic data type that includes a particular
constructor.
For examples, see the Data.OpenADT.Tutorial
module.
Downloads
- open-adt-1.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 1.0 |
---|---|
Dependencies | base (>=4.9 && <5), constraints (>=0.8 && <1), recursion-schemes (>=5 && <6), row-types (>=0.2.3 && <1), template-haskell (>=2.12 && <3) [details] |
Tested with | ghc ==8.2.1, ghc ==8.2.2, ghc ==8.4.1, ghc ==8.4.2, ghc ==8.4.3 |
License | BSD-3-Clause |
Copyright | Copyright (c) 2018 Jordan Woehr |
Author | |
Maintainer | Jordan Woehr |
Category | Data |
Home page | https://github.com/woehr/open-adt |
Bug tracker | https://github.com/woehr/open-adt/issues |
Source repo | head: git clone https://github.com/woehr/open-adt |
Uploaded | by Woehr at 2018-11-25T18:23:17Z |
Distributions | |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 700 total (5 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2018-11-25 [all 1 reports] |