paperbot · PL 论文追踪

全部论文 待读 收藏

P2 First-class names for effect handlers

效应处理器的一等名称
OOPSLA 6(OOPSLA2)2022匹配度 2/10 · 该论文属于纯函数式编程语言设计与类型系统(效应处理器、rank-2 多态、scoped effects),既未涉及 LLM/Agentic 程序或机器学习系统的静态分析,也与浮点程序分析、贝叶斯程序分析无关。虽同属 PL 领域且兼具形式化与 Koka 实现,但与用户当前追踪的四条主线均无交叉。引用 10 inbox
Ningning Xie, Youyou Cong, Kazuki Ikemori, Daan Leijen
crossref: 2026-09-10

AI 速览

一句话:提出将效应处理器名称作为一等值,并借助 scoped effects 与 rank-2 多态防止名称逃逸的命名处理器设计。

代数效应与处理器能让函数式语言组合地表达计算效应,但难以区分同一效应的多个实例。已有的命名效应处理器虽可区分实例,却依赖非标准机制防止处理器名逃逸,形式化复杂且限制较强。本文提出一种简单灵活的命名处理器设计:将处理器名作为一等值,并与通过 rank-2 多态维护作用域的 scoped effects 结合,从而在普通 λ 演算中防止名称逃逸。作者形式化了命名处理器与 scoped effects 的两种组合,并在 Koka 语言中实现,还给出神经网络与合一算法等应用。

问题
已有命名效应处理器形式化依赖非标准机制防止处理器名逃逸,复杂且限制性强,难以在普通 λ 演算中安全区分同一效应的不同实例。
方法
将处理器名视为一等值,并与通过 rank-2 多态维护作用域的 scoped effects 结合,在普通 λ 演算内防止名称逃逸;形式化两种组合并在 Koka 中实现。
评估
通过两种组合的形式化、Koka 实现以及神经网络与合一算法等应用案例进行评估。
原文摘要(Abstract)

Algebraic effects and handlers are a promising technique for incorporating composable computational effects into functional programming languages. Effect handlers enable concisely programming with different effects, but they do not offer a convenient way to program with different instances of the same effect. As a solution to this inconvenience, previous studies have introduced _named effect handlers_, which allow the programmer to distinguish among different effect instances. However, existing formalizations of named handlers are both involved and restrictive, as they employ non-standard mechanisms to prevent the escaping of handler names. In this paper, we propose a simple and flexible design of named handlers. Specifically, we treat handler names as first-class values, and prevent their escaping while staying within the ordinary λ-calculus. Such a design is enabled by combining named handlers with _scoped effects_, a novel variation of effects that maintain a scope via rank-2 polymorphism. We formalize two combinations of named handlers and scoped effects, and implement them in the Koka programming language. We also present practical applications of named handlers, including a neural network and a unification algorithm.

链接与引用

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

BibTeX
@article{paperbot1460,
  title = {First-class names for effect handlers},
  author = {Ningning Xie and Youyou Cong and Kazuki Ikemori and Daan Leijen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA2},
  year = {2022},
  doi = {10.1145/3563289}
}