paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A role for dependent types in Haskell

Haskell 中依赖类型的角色机制
ICFP 3(ICFP)2019匹配度 2/10 · 论文关注 Haskell 依赖类型与角色机制的可靠性证明,属于纯类型系统与定理证明工程,未涉及 LLM/Agent、机器学习、静态分析应用、浮点或贝叶斯程序分析。与用户画像中 PL 与 AI 交叉的核心问题基本无关。引用 12 inbox
Stephanie Weirich, Pritam Choudhury, Antoine Voizard, Richard A. Eisenberg
crossref: 2026-09-10

AI 速览

一句话:将角色机制融入依赖类型系统并在 Coq 中证明其可靠性,为 GHC 引入依赖类型奠定基础。

现代 Haskell 支持零成本强制转换(coercion),允许运行时表示相同的类型之间自由转换,这一特性依靠角色(role)机制来禁止不安全的转换。然而,如何将角色机制融入依赖类型系统尚不明确。本文展示了如何把角色引入依赖类型系统,并使用 Coq 证明助手对所得系统的可靠性(soundness)进行了机器化验证。该工作被设计为在 Glasgow Haskell Compiler(GHC)中添加依赖类型的基础,同时也可供其他希望采纳 Haskell 安全强制转换特性的依赖类型语言设计者参考。关键结果是给出了一个经过形式化验证的、支持角色的依赖类型系统。

问题
在将依赖类型引入 GHC 时,如何安全地整合 Haskell 现有的零成本强制转换与角色机制,防止不安全的类型转换。
方法
将角色机制扩展到依赖类型系统,并在 Coq 证明助手中对该系统的类型规则进行形式化并证明其可靠性。
评估
通过 Coq 机器化证明来验证系统的可靠性;该设计为 GHC 添加依赖类型提供基础,并可推广到其他依赖类型语言。
原文摘要(Abstract)

Modern Haskell supports zero-cost coercions, a mechanism where types that share the same run-time representation may be freely converted between. To make sure such conversions are safe and desirable, this feature relies on a mechanism of roles to prohibit invalid coercions. In this work, we show how to incorporate roles into dependent types systems and prove, using the Coq proof assistant, that the resulting system is sound. We have designed this work as a foundation for the addition of dependent types to the Glasgow Haskell Compiler, but we also expect that it will be of use to designers of other dependently-typed languages who might want to adopt Haskell’s safe coercions feature.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot593,
  title = {A role for dependent types in Haskell},
  author = {Stephanie Weirich and Pritam Choudhury and Antoine Voizard and Richard A. Eisenberg},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {3},
  number = {ICFP},
  year = {2019},
  doi = {10.1145/3341705}
}