paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Type-level programming with match types

使用 match types 的类型级编程
POPL 6(POPL)2022匹配度 2/10 · 该论文属于类型系统与编程语言设计,形式化了 match types 并在 Scala 3 中实现,虽然兼具理论形式化与工程实现,但与用户核心方向(PL 与 AI/LLM/Agent 交叉、静态分析、浮点程序分析、贝叶斯程序分析)几乎没有直接关联。引用 9 inbox
Olivier Blanvillain, Jonathan Immanuel Brachthäuser, Maxime Kjaer, Martin Odersky
crossref: 2026-09-10

AI 速览

一句话:提出 match types——类型级的模式匹配,在基于 System F<: 的演算中形式化并证明可靠性,并在 Scala 3 编译器中实现。

类型级编程在函数式编程领域日益流行,但它与子类型的结合在实用编程语言中仍鲜有探索。本文提出 match types,即模式匹配在类型层面的对应物:它能够无缝融入带子类型的语言,并且尽管形式简单,却显著提升了类型级计算的表达力。作者在基于 System F<: 的演算中形式化了 match types 这一特性,并证明了该系统的可靠性(soundness),从而为其在带子类型语言中的使用提供了理论基础。在实践层面,作者将 match types 实现在 Scala 3 参考编译器中,使类型级编程能够为广泛的程序员群体直接可用,并借此验证了该设计在真实语言实现中的可行性。

问题
类型级编程在函数式编程中越来越常见,但其与子类型的结合在实用语言中仍基本未被探索,缺少既表达力强又可靠的机制。
方法
提出 match types,即类型层面的模式匹配,可自然集成进带子类型的语言;并在基于 System F<: 的演算中形式化该特性,证明其可靠性。
评估
在 Scala 3 参考编译器中实现 match types,通过这一真实实现验证设计可行性,并使类型级编程对广大程序员可用。
原文摘要(Abstract)

Type-level programming is becoming more and more popular in the realm of functional programming. However, the combination of type-level programming and subtyping remains largely unexplored in practical programming languages. This paper presents match types , a type-level equivalent of pattern matching. Match types integrate seamlessly into programming languages with subtyping and, despite their simplicity, offer significant additional expressiveness. We formalize the feature of match types in a calculus based on System F sub and prove its soundness. We practically evaluate our system by implementing match types in the Scala 3 reference compiler, thus making type-level programming readily available to a broad audience of programmers.

链接与引用

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

BibTeX
@article{paperbot1589,
  title = {Type-level programming with match types},
  author = {Olivier Blanvillain and Jonathan Immanuel Brachthäuser and Maxime Kjaer and Martin Odersky},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {POPL},
  year = {2022},
  doi = {10.1145/3498698}
}