arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1803.08150cs.PL
收藏

依赖类型的通用零成本重用

Generic Zero-Cost Reuse for Dependent Types

Larry Diehl, Denis Firsov, Aaron Stump

摘要:

众所周知,依赖类型语言在代码重用方面存在问题。传统的非索引代数数据库(例如列表)与大量的索引变量(例如向量)一起出现。函数经常被重写为基本相同数据类型的非索引和索引版本,这是代码重复的来源。我们在Curry风格的依赖类型论中工作,其中相同的未类型化术语可以被分类为数据类型的非索引版本和索引版本。对于依赖类型的重用问题,已经提出了许多解决方案,但是我们在解决方案中利用Curry风格的类型论,不仅重用数据和程序,而且以零成本(没有运行时损失)这样做。我们的工作是一个练习依赖类型的泛型编程,并内化的过程中的零成本重用的身份功能的咖喱风格的理论。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑