caml-list - the Caml user's mailing list
 help / Atom feed
* [Caml-list] (ANN) Lightweight HList -- typed heterogeneous collections
@ 2020-08-20 13:37 Oleg
  0 siblings, 0 replies; 1+ messages in thread
From: Oleg @ 2020-08-20 13:37 UTC (permalink / raw)
  To: caml-list

This is a (very late) announcement of the pure OCaml lightweight
analogue of HList -- typed heterogeneous collections. Such collections
store data of various types, and offer element access/modification
plus bulk operations such as mapping and iteration. In HList, the type
of the collection reflects the types of the elements; therefore all
type mismatches can be detected statically. Correspondingly, there
is no need to store any type information at run-time.

The library was actually written two years ago. I have just realized I
neglected to announce it. The implementation is fairly trivial, but
does come useful from time to time, e.g., to implement polyvariadic
functions. One interesting facility is the ability to replace an
element somewhere in a collection with a new one of a different
type. The type of the returned collection is changed

A more detailed description, and the pointer to the code is:

The code contains several examples, including multi-dimensional
cartesian product: converting an HList of regular lists to a list of
tuples, elements of the cartesian product.

A somewhat non-trivial application of HList (specifically,
type-changing update) is the tagless-final embedding of simply-typed
lambda-calculus with De Bruijn *levels*:
At first glance, an embedding that relies on OCaml typechecker to
check and infer types of lambda-terms seems impossible.

^ permalink raw reply	[flat|nested] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 13:37 [Caml-list] (ANN) Lightweight HList -- typed heterogeneous collections Oleg

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror

AGPL code for this site: git clone public-inbox