Logo image
Zero-Cost Constructor Subtyping
Conference proceeding   Open access

Zero-Cost Constructor Subtyping

Andrew Marmaduke, Christopher Jenkins and Aaron Stump
IFL '20: Proceedings of the 32nd Symposium on Implementation and Application of Functional Languages, pp.93-103
IFL 2020: 32nd Symposium on Implementation and Application of Functional Languages (Canterbury, United Kingdom, 09/02/2020–09/04/2020)
07/23/2021
DOI: 10.1145/3462172.3462194
url
https://doi.org/10.1145/3462172.3462194View
Published (Version of record) Open Access

Abstract

Constructor subtyping is a form of subtyping where two inductive types can be related as long as the inductive signature of one is a subsignature of the other. To be a subsignature requires every constructor of the smaller datatype be present in the larger datatype (modulo subtyping of the constructors’ types). In this paper, we describe a method for impredicatively encoding datatype signatures in Cedille (a dependently typed programming language) that supports highly flexible constructor subtyping, with the subtyping relation given by a derived notion of type inclusion witnessed by a heterogeneously typed identity function. Specifically, the conditions under which constructor subtyping is possible between datatypes are fully independent of the order in which constructors are listed in their declarations. After examining some extended case studies, we formulate generically a sufficient condition for constructor subtyping in Cedille using our technique.
generic programming impredicative encodings constructor subtyping Cedille UIOWA OA Agreement

Details

Metrics

9 Record Views
Logo image