Skip to main content

Disciplined‚ efficient‚ generalised folds for nested datatypes

Clare Martin‚ Jeremy Gibbons and Ian Bayley

Abstract

Nested (or non-uniform, or non-regular) datatypes have recursive definitions in which the type parameter changes. Their folds are restricted in power due to type constraints. Bird and Paterson introduced generalised folds for extra power, but at the cost of a loss of efficiency: folds may take more than linear time to evaluate. Hinze introduced efficient generalised folds to counter this inefficiency, but did so in a pragmatic way, at the cost of a loss of reasoning power: without categorical or equivalent underpinnings, there are no universal properties for manipulating folds. We combine the efficiency of Hinze's construction with the powerful reasoning tools of Bird and Paterson's.

Journal
Formal Aspects of Computing
Number
1
Pages
19−35
Volume
16
Year
2004