paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Associated Effects: Flexible Abstractions for Effectful Programming

关联效应:面向效应式编程的灵活抽象
PLDI 8(PLDI)2024匹配度 2/10 · 该论文属于纯编程语言设计与类型/效应系统方向,提出并实现 associated effects,与用户核心关注的静态分析、Agentic/LLM 程序分析、浮点程序分析、贝叶斯程序分析及 LLM 交叉均无直接关联。引用 7 inbox
Matthew Lutze, Magnus Madsen
crossref: 2026-09-10

AI 速览

一句话:提出关联效应,使类型类能抽象其函数签名中的效应、由各实例指定具体效应,并在 Flix 中实现。

论文针对类型与效应系统同类型类结合时表达力受限的问题:类型类无法对其方法签名中的效应进行抽象,因而难以同时刻画纯函数与可能抛异常的偏函数、不可变数据结构与带堆效应的可变数据结构。作者提出「关联效应」(associated effects),允许类型类对其函数签名的效应进行抽象,并由每个类型类实例给出具体效应,从而在保留类型类抽象能力的同时支持效应多态。该特性实现为 Flix 语言的扩展,并据此重构 Flix 标准库:为 11 个类型类加入关联效应,新增 28 个类型类实例。三个典型应用包括抽象全函数与偏函数、抽象不可变与带堆效应的可变数据结构,以及实现将类型类与代数效应结合的适配器,显著提升了语言的灵活性与表达力。

问题
在同时具备类型与效应系统和类型类的语言中,类型类无法抽象其方法签名中的效应,导致无法统一抽象纯与不纯、全与偏、不可变与可变等实现。
方法
提出关联效应这一语言特性,使类型类可对函数签名的效应进行抽象并由实例指定具体效应;将其实现为 Flix 语言扩展,并用它重构 Flix 标准库。
评估
在 Flix 中实现关联效应,为 11 个类型类引入该特性并新增 28 个类型类实例,通过重构标准库及三类用例(全/偏函数、不可变/可变数据结构、类型类与代数效应适配器)验证其表达力与灵活性。
原文摘要(Abstract)

We present associated effects, a programming language feature that enables type classes to abstract over the effects of their function signatures, allowing each type class instance to specify its concrete effects. Associated effects significantly increase the flexibility and expressive power of a programming language that combines a type and effect system with type classes. In particular, associated effects allow us to (i) abstract over total and partial functions, where partial functions may throw exceptions, (ii) abstract over immutable data structures and mutable data structures that have heap effects, and (iii) implement adaptors that combine type classes with algebraic effects. We implement associated effects as an extension of the Flix programming language and refactor the Flix Standard Library to use associated effects, significantly increasing its flexibility and expressive power. Specifically, we add associated effects to 11 type classes, which enables us to add 28 new type class instances. CCS Concepts: • Software and its engineering → Language features .

链接与引用

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

BibTeX
@article{paperbot2517,
  title = {Associated Effects: Flexible Abstractions for Effectful Programming},
  author = {Matthew Lutze and Magnus Madsen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {PLDI},
  year = {2024},
  doi = {10.1145/3656393}
}