Generic zero-cost reuse for dependent types
Authors:
Open Access
- 30 July 2018
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 2 (ICFP) , 1-30
Abstract
Dependently typed languages are well known for having a problem with code reuse. Traditional non-indexed algebraic datatypes (e.g. lists) appear alongside a plethora of indexed variations (e.g. vectors). Functions are often rewritten for both non-indexed and indexed versions of essentially the same datatype, which is a source of code duplication. We work in a Curry-style dependent type theory, where the same untyped term may be classified as both the non-indexed and indexed versions of a datatype. Many solutions have been proposed for the problem of dependently typed reuse, but we exploit Curry-style type theory in our solution to not only reuse data and programs, but do so at zero-cost (without a runtime penalty). Our work is an exercise in dependently typed generic programming, and internalizes the process of zero-cost reuse as the identity function in a Curry-style theory.Keywords
All Related Versions
Funding Information
- U.S. Department of War (FA9550-16-1-0082)
- National Science Foundation (1524519)
This publication has 13 references indexed in Scilit:
- Safe zero-cost coercions for HaskellJournal of Functional Programming, 2016
- The Lean Theorem Prover (System Description)2015
- Type-theory in color2013
- Relational algebraic ornaments2013
- Idris, a general-purpose dependently typed programming language: Design and implementationJournal of Functional Programming, 2013
- Transporting functions across ornaments2012
- The view from the leftJournal of Functional Programming, 2004
- The Implicit Calculus of Constructions Extending Pure Type Systems with an Intersection Type Binder and Subtyping2001
- Induction Is Not Derivable in Second Order Dependent Type Theory2001
- Typability and type checking in System F are equivalent and undecidableAnnals of Pure and Applied Logic, 1999