paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Generalized evidence passing for effect handlers: efficient compilation of effect handlers to C

广义证据传递的效应处理器:将效应处理器高效编译到 C
ICFP 5(ICFP)2021匹配度 1/10 · 论文属于编程语言编译与代数效应处理器优化,关注将 effect handlers 高效编译到 C,未涉及用户画像中的静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析等核心方向。引用 19 inbox
Ningning Xie, Daan Leijen
crossref: 2026-09-10

AI 速览

一句话:提出广义证据传递等精化技术,把代数效应处理器高效编译到 C,性能超越多个最佳实现。

本文研究代数效应处理器的编译技术。作者提出一系列逐步精化的中间形式:从代数效应出发,经过多提示定界控制、广义证据传递(generalized evidence passing)、yield bubbling,最终以单子翻译归约为纯 lambda 演算,从而可高效编译到多种目标平台。文中还探讨了该设计空间中的若干有趣设计点。作者给出两种实现:一个 Haskell 库,以及 Koka 语言的 C 后端。评估上将所提技术与另外三种同类最佳实现进行比较,包括多核 OCaml、Haskell 的 Ev.Eff 库与 C 的 libhandler 库,结果表明该技术十分有效。作者期望这项工作能为未来代数效应的设计与实现奠定基础。

问题
代数效应处理器功能强大,但如何将其高效编译到 C 等底层平台,同时兼顾性能与可移植性,仍是一个开放问题。
方法
通过多提示定界控制、广义证据传递、yield bubbling 逐步精化代数效应,并最终单子翻译为纯 lambda 演算,可在多平台高效编译;实现为 Haskell 库与 Koka 的 C 后端。
评估
将两种实现与多核 OCaml、Haskell 的 Ev.Eff 库及 C 的 libhandler 库三种最佳实现进行性能对比,验证了技术的有效性。
原文摘要(Abstract)

This paper studies compilation techniques for algebraic effect handlers. In particular, we present a sequence of refinements of algebraic effects, going via multi-prompt delimited control, _generalized evidence passing_, yield bubbling, and finally a monadic translation into plain lambda calculus which can be compiled efficiently to many target platforms. Along the way we explore various interesting points in the design space. We provide two implementations of our techniques, one as a library in Haskell, and one as a C backend for the Koka programming language. We show that our techniques are effective, by comparing against three other best-in-class implementations of effect handlers: multi-core OCaml, the _Ev.Eff_ Haskell library, and the libhandler C library. We hope this work can serve as a basis for future designs and implementations of algebraic effects.

链接与引用

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

BibTeX
@article{paperbot1117,
  title = {Generalized evidence passing for effect handlers: efficient compilation of effect handlers to C},
  author = {Ningning Xie and Daan Leijen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {5},
  number = {ICFP},
  year = {2021},
  doi = {10.1145/3473576}
}