caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] (ANN) Lightweight HList -- typed heterogeneous collections
@ 2020-08-20 13:41 Oleg
  0 siblings, 0 replies; only message in thread
From: Oleg @ 2020-08-20 13:41 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] only message in thread

only message in thread, other threads:[~2020-08-20 13:37 UTC | newest]

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

caml-list - the Caml user's mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 caml-list caml-list/ \
	public-inbox-index caml-list

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone