当前位置: X-MOL 学术arXiv.cs.PL › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Coming to Terms with Your Choices: An Existential Take on Dependent Types
arXiv - CS - Programming Languages Pub Date : 2020-11-15 , DOI: arxiv-2011.07653
Georg Stefan Schmid (EPFL), Olivier Blanvillain (EPFL), Jad Hamza (EPFL), Viktor Kun\v{c}ak (EPFL)

Type-level programming is an increasingly popular way to obtain additional type safety. Unfortunately, it remains a second-class citizen in the majority of industrially-used programming languages. We propose a new dependently-typed system with subtyping and singleton types whose goal is to enable type-level programming in an accessible style. At the heart of our system lies a non-deterministic choice operator. We argue that embracing non-determinism is crucial for bringing dependent types to a broader audience of programmers, since real-world programs will inevitably interact with imprecisely-typed, or even impure code. Furthermore, we show that singleton types combined with the choice operator can serve as a replacement for many type functions of interest in practice. We establish the soundness of our approach using the Coq proof assistant. Our soundness approach models non-determinism using additional function arguments to represent choices. We represent type-level computation using singleton types and existential types that quantify over choice arguments. To demonstrate the practicality of our type system, we present an implementation as a modification of the Scala compiler. We provide a case study in which we develop a strongly-typed wrapper for Spark datasets.

中文翻译:

接受你的选择:依赖类型的存在主义

类型级编程是一种越来越流行的获得额外类型安全的方式。不幸的是,在大多数工业使用的编程语言中,它仍然是二等公民。我们提出了一个新的依赖类型系统,它具有子类型和单例类型,其目标是以可访问的风格启用类型级编程。我们系统的核心是一个非确定性选择算子。我们认为,拥抱非确定性对于将依赖类型带给更广泛的程序员来说至关重要,因为现实世界的程序将不可避免地与类型不精确甚至不纯的代码进行交互。此外,我们表明,与选择运算符相结合的单例类型可以替代许多在实践中感兴趣的类型函数。我们使用 Coq 证明助手来确定我们方法的合理性。我们的稳健性方法使用附加函数参数来表示选择来模拟非确定性。我们使用单例类型和对选择参数进行量化的存在类型来表示类型级计算。为了演示我们的类型系统的实用性,我们展示了一个对 Scala 编译器的修改的实现。我们提供了一个案例研究,其中我们为 Spark 数据集开发了一个强类型包装器。
更新日期:2020-11-17
down
wechat
bug