Modularising inductive families
- 1 March 2013
- journal article
- Published by National Institute of Informatics (NII) in Progress in Informatics
- No. 10,p. 65
Abstract
Dependently typed programmers are encouraged to use inductive families to integrate constraints with data construction. Different constraints are used in different contexts, leading to different versions of datatypes for the same data structure. For example, sequences might be constrained by length or by an ordering on elements, giving rise to different datatypes “vectors” and “sorted lists” for the same underlying data structure of sequences. Modular implementation of common operations for these structurally similar datatypes has been a longstanding problem. We propose a datatype-generic solution, in which we axiomatise a family of isomorphisms between datatypes and their more refined versions as datatype refinements, and show that McBride’s ornaments can be translated into such refinements. With the ornament-induced refinements, relevant properties of the operations can be separately proven for each constraint, and after the programmer selects several constraints to impose on a basic datatype and synthesises a new datatype incorporating those constraints, the operations can be routinely upgraded to work with the synthesised datatype. This is a heavily revised version of the paper with the same title previously published in WGP'11. Supplementary material The accompanying Agda code can be found here: a zip archive of the Agda source files or a syntax-highlighted, browsable HTML version.</PKeywords
This publication has 8 references indexed in Scilit:
- Transporting functions across ornaments2012
- Modularising inductive families2011
- Realizability and Parametricity in Pure Type Systems2011
- The gentle art of levitation2010
- Singleton types here, singleton types there, singleton types everywhere2010
- Dependently Typed Programming in Agda2009
- Purely Functional Data Structures1998
- Inductive familiesFormal Aspects of Computing, 1994