Affiliation:
1. McGill University, Canada
Abstract
Indexed data types allow us to specify and verify many interesting invariants about finite data in a general purpose programming language. In this paper we investigate the dual idea: indexed codata types, which allow us to describe data-dependencies about infinite data structures. Unlike finite data which is defined by constructors, we define infinite data by observations. Dual to pattern matching on indexed data which may refine the type indices, we define copattern matching on indexed codata where type indices guard observations we can make.
Our key technical contributions are three-fold: first, we extend Levy's call-by-push value language with support for indexed (co)data and deep (co)pattern matching; second, we provide a clean foundation for dependent (co)pattern matching using equality constraints; third, we describe a small-step semantics using a continuation-based abstract machine, define coverage for indexed (co)patterns, and prove type safety. This is an important step towards building a foundation where (co)data type definitions and dependent types can coexist.
Funder
Fonds Québécois de la Recherche sur la Nature et les Technologies
Natural Sciences and Engineering Research Council of Canada
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
6 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Deriving Dependently-Typed OOP from First Principles;Proceedings of the ACM on Programming Languages;2024-04-29
2. Pipelines and Beyond: Graph Types for ADTs with Futures;Proceedings of the ACM on Programming Languages;2024-01-05
3. Codata in Action;Programming Languages and Systems;2019
4. Elaborating dependent (co)pattern matching;Proceedings of the ACM on Programming Languages;2018-07-30
5. Copattern matching and first-class observations in OCaml, with a macro;Proceedings of the 19th International Symposium on Principles and Practice of Declarative Programming;2017-10-09