Haskell library implementing "Data Types a la Carte"
See the codeThis library implements the ideas of Data types a la carte (Wouter Swiestra, Journal of Functional Programming, 18(4):423-436, 2008) as outlined in the paper Compositional data types (Patrick Bahr and Tom Hvitved, Workshop on Generic Programming, 83-94, 2011). The purpose of this library is to allow the programmer to construct data types -- as well as the functions defined on them -- in a modular fashion. The underlying idea is to separate the signature of a data type from the fixed point construction that produces its recursive structure. Signatures can then be composed and decomposed freely.
Building on that foundation, this library provides additional extensions and (run-time) optimisations which make compositional data types usable for practical implementations. In particular, it provides an excellent framework for manipulating and analysing abstract syntax trees in a type-safe manner. Thus, it is perfectly suited for programming language implementations, especially, in an environment consisting of a family of tightly interwoven domain-specific languages.
In concrete terms, this library provides the following features:
Prelude.Eq, Prelude.Ord and Prelude.Show that are
derived via instances for functorial variants of them. Additionally,
also smart constructors, which allow to easily construct inhabitants
of compositional data types, are automatically generated.Examples of using (generalised) compositional data types are bundled
with the package in the folder examples.
There are some supplementary packages, some of which were included in previous versions of this package:
compdata-param: a parametric
variant of compositional data types to deal with variable binders
in a systematic way.compdata-automata:
advanced recursion schemes derived from tree automata that allow for
a higher degree of modularity and make it possible to apply fusion.compdata-dags: recursion
schemes on directed acyclic graphs.Haskell
99.8%
Haskell library implementing "Data Types a la Carte"
See the codeThis library implements the ideas of Data types a la carte (Wouter Swiestra, Journal of Functional Programming, 18(4):423-436, 2008) as outlined in the paper Compositional data types (Patrick Bahr and Tom Hvitved, Workshop on Generic Programming, 83-94, 2011). The purpose of this library is to allow the programmer to construct data types -- as well as the functions defined on them -- in a modular fashion. The underlying idea is to separate the signature of a data type from the fixed point construction that produces its recursive structure. Signatures can then be composed and decomposed freely.
Building on that foundation, this library provides additional extensions and (run-time) optimisations which make compositional data types usable for practical implementations. In particular, it provides an excellent framework for manipulating and analysing abstract syntax trees in a type-safe manner. Thus, it is perfectly suited for programming language implementations, especially, in an environment consisting of a family of tightly interwoven domain-specific languages.
In concrete terms, this library provides the following features:
Prelude.Eq, Prelude.Ord and Prelude.Show that are
derived via instances for functorial variants of them. Additionally,
also smart constructors, which allow to easily construct inhabitants
of compositional data types, are automatically generated.Examples of using (generalised) compositional data types are bundled
with the package in the folder examples.
There are some supplementary packages, some of which were included in previous versions of this package:
compdata-param: a parametric
variant of compositional data types to deal with variable binders
in a systematic way.compdata-automata:
advanced recursion schemes derived from tree automata that allow for
a higher degree of modularity and make it possible to apply fusion.compdata-dags: recursion
schemes on directed acyclic graphs.Haskell
99.8%