A completely unique account of enumeration

Journal Article (2022)
Author(s)

Cas Van Der Rest (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Wouter Swierstra (Universiteit Utrecht)

Research Group
Programming Languages
DOI related publication
https://doi.org/10.1145/3547636 Final published version
More Info
expand_more
Publication Year
2022
Language
English
Research Group
Programming Languages
Journal title
Proceedings of the ACM on Programming Languages
Issue number
ICFP
Volume number
6
Article number
105
Downloads counter
302
Collections
Institutional Repository
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

How can we enumerate the inhabitants of an algebraic datatype? This paper explores a datatype generic solution that works for all regular types and indexed families. The enumerators presented here are provably both complete and unique - they will eventually produce every value exactly once - and fair - they avoid bias when composing enumerators. Finally, these enumerators memoise previously enumerated values whenever possible, thereby avoiding repeatedly recomputing recursive results.