Types and Semantics for Extensible Data Types (Extended Version)
Preprint
Abstract
Developing and maintaining software commonly requires (1) adding new data type constructors to existing applications, but also (2) adding new functions that work on existing data. Most programming languages have native support for defining data types and functions in a way that supports either (1) or (2), but not both. This lack of native support makes it difficult to use and extend libraries. A theoretically well-studied solution is to define data types and functions using initial algebra semantics. While it is possible to encode this solution in existing programming languages, such encodings add syntactic and interpretive overhead, and commonly fail to take advantage of the map and fold fusion laws of initial algebras which compilers could exploit to generate more efficient code. A solution to these is to provide native support for initial algebra semantics. In this paper, we develop such a solution and present a type discipline and core calculus for a language with native support for initial algebra semantics.Keywords
All Related Versions
This publication has 34 references indexed in Scilit:
- Structured Handling of Scoped Effects2022
- Towards a Language for Defining Reusable Programming Language Components2022
- Latent Effects for Reusable Language Components2021
- Parametricity for Primitive Nested Types2021
- A Syntactic View of Computational Adequacy2018
- (Co-)Iteration for Higher-Order Nested Datatypes2003
- Generalized Iteration and Coiteration for Higher-Order Nested DatatypesLecture Notes in Computer Science, 2003
- Programming with algebrasLecture Notes in Computer Science, 1995
- Functional programming with bananas, lenses, envelopes and barbed wire1991
- Inductively defined types1990