Jamet, Arthur, Vollmer, Michael (2026) Programmable record types in Haskell. In: GPCE '26: Proceedings of the 25th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences. Association for Computing Machinery, New York ISBN 979-8-4007-2718-4. (doi:10.1145/3814885.3816408) (KAR id:115963)
|
PDF
Publisher pdf
Language: English
This work is licensed under a Creative Commons Attribution 4.0 International License.
|
|
|
Download this file (PDF/672kB) |
Preview |
| Request a format suitable for use with assistive technology e.g. a screenreader | |
| Official URL: https://doi.org/10.1145/3814885.3816408 |
|
Abstract
In Haskell, accessing an object's fields requires deconstructing it. Thankfully, it is possible to name the fields of a data type using the record syntax, allowing programmers to access objects' fields using their name. This can help improve the readability of Haskell code. However, Haskell's support for record types is limited, as its type system is nominal, and the language does not allow composing record types.
Previous work tackled this issue using type-level computations at compile time and linked lists at runtime. Since these approaches do not use native record data types, operations on such records (e.g. traversals) are consequently slower than on native data types.
In this paper, we leverage meta-programming and code generation to enable easy record composition and simulate structural subtyping, using type-transforming functions and typeclasses generated at compile time. The resulting Haskell library, named type-machine, generates native record data types. Its API allows users to write their own functions to compose record types. Our approach does not require any compiler or runtime modifications.
Our benchmarks show that records generated by type-machine are at least 40% faster to traverse than records defined using state-of-the-art libraries. Additionally, simple programs that define data types using type-machine are at least 3x faster to compile than isomorphic programs that use these libraries.
We present use cases of the library along with examples of custom type transformers.
| Item Type: | Conference proceeding |
|---|---|
| DOI/Identification number: | 10.1145/3814885.3816408 |
| Uncontrolled keywords: | Data Types, Records, Code Generation |
| Subjects: | Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming, |
| Institutional Unit: | Schools > School of Computing |
| Former Institutional Unit: |
There are no former institutional units.
|
| Funders: | University of Kent (https://ror.org/00xkeyj56) |
| Depositing User: | Arthur Jamet |
| Date Deposited: | 20 Aug 2026 15:22 UTC |
| Last Modified: | 25 Aug 2026 08:34 UTC |
| Resource URI: | https://kar.kent.ac.uk/id/eprint/115963 (The current URI for this page, for reference purposes) |
- Link to SensusAccess
- Export to:
- RefWorks
- EPrints3 XML
- BibTeX
- CSV
- Depositors only (login required):

https://orcid.org/0000-0002-0496-8268
Altmetric
Altmetric