The university library will be closed from December 20, 2025 to January 11, 2026. From January 12, 2026, regular opening hours will apply again. Exception: The main medical library and the central library will be open again from January 5, 2026. Further information

Result: Datatype-Generic Programming Meets Elaborator Reflection (Artefact)

Title:
Datatype-Generic Programming Meets Elaborator Reflection (Artefact)
Authors:
Ko, Chen, Lin
Publisher Information:
Zenodo
Publication Year:
2022
Collection:
Zenodo
Document Type:
Conference conference object
Language:
unknown
DOI:
10.5281/zenodo.6954977
Rights:
Creative Commons Attribution 4.0 International ; cc-by-4.0 ; https://creativecommons.org/licenses/by/4.0/legalcode
Accession Number:
edsbas.AD1D442B
Database:
BASE

Further information

Datatype-generic programming is natural and useful in dependently typed languages such as Agda. However, datatype-generic libraries in Agda are not reused as much as they should be, because traditionally they work only on datatypes decoded from a library’s own version of datatype descriptions; this means that different generic libraries cannot be used together, and they do not work on native datatypes, which are preferred by the practical Agda programmer for better language support and access to other libraries. Based on elaborator reflection, we present a framework in Agda featuring a set of general metaprograms for instantiating datatype-generic programs as, and for, a useful range of native datatypes and functions —including universe-polymorphic ones— in programmer-friendly and customisable forms. We expect that datatype-generic libraries built with our framework will be more attractive to the practical Agda programmer. As the elaborator reflection features used by our framework become more widespread, our design can be ported to other languages too.