JUCS - Journal of Universal Computer Science 23(1): 42-62, doi: 10.3217/jucs-023-01-0042
Trees that Grow
expand article infoShayan Najd, Simon Peyton Jones§
‡ The University of Edinburgh, Edinburgh, United Kingdom§ Microsoft Research, Cambridge, United Kingdom
Open Access
Abstract
We study the notion of extensibility in functional data types, as a new approach to the problem of decorating abstract syntax trees with additional information. We observed the need for such extensibility while redesigning the data types representing Haskell abstract syntax inside Glasgow Haskell Compiler (GHC). Specifically, we describe a programming idiom that exploits type-level functions to allow a particular form of extensibility. The approach scales to support existentials and generalised algebraic data types, and we can use pattern synonyms to make it convenient in practice.
Keywords
functional programming, Haskell, algebraic data types, pattern matching, open data types, extensible data types, expression problem, tree decoration tree annotation