arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.16381cs.PL
收藏

代数效应处理器的抽象效应系统

Abstracting Effect Systems for Algebraic Effect Handlers

Takuma Yoshioka, Taro Sekiyama, Atsushi Igarashi

AI总结:

本文提出了配备抽象效应系统的语言 ${λ_{\mathrm{EA}}}$,通过参数化的效应代数和特定安全条件,统一并验证了现有代数效应处理器系统的安全性,且扩展支持强制转换与类型擦除语义以区分不同系统的安全特性。

摘要:

许多针对代数效应处理器(algebraic effect handlers)的效应系统旨在保证所有被调用的效应都能得到充分处理。然而,相关研究人员各自开发了不同的效应系统,它们在如何表示可能发生的效应集合方面存在差异。这种情况导致在安全的效应系统中,效应集合的表示和操作究竟需要什么变得模糊。\n在这项工作中,我们提出了一种语言 ${λ_{\mathrm{EA}}}$,该语言配备了一个效应系统,用于抽象现有的代数效应处理器效应系统。${λ_{\mathrm{EA}}}$ 的效应系统以效应代数(effect algebras)为参数,这些代数抽象了安全效应系统中效应集合的表示和操作。我们通过假设给定的效应代数满足称为安全条件的某些属性,证明了 ${λ_{\mathrm{EA}}}$ 的类型与效应安全性。因此,通过证明与具体系统相对应的效应代数满足安全条件,我们可以获得具体效应系统的安全属性。我们还表明,满足安全条件的效应代数具有足够的表达能力,可以容纳一些现有的效应系统,每个系统都以不同的风格表示效应集合。我们的框架还可以区分现有效应系统的效应集合的安全方面。为此,我们扩展了 ${λ_{\mathrm{EA}}}$ 和安全条件以提升强制转换(coercions)和类型擦除语义(type-erasure semantics),提出了其他效应代数,包括文献中尚未研究过其效应系统的代数,并比较了在扩展中哪些效应代数是安全的,哪些是不安全的。

英文摘要:

Many effect systems for algebraic effect handlers are designed to guarantee that all invoked effects are handled adequately. However, respective researchers have developed their own effect systems that differ in how to represent the collections of effects that may happen. This situation results in blurring what is required for the representation and manipulation of effect collections in a safe effect system. In this work, we present a language ${λ_{\mathrm{EA}}}$ equipped with an effect system that abstracts the existing effect systems for algebraic effect handlers. The effect system of ${λ_{\mathrm{EA}}}$ is parameterized over effect algebras, which abstract the representation and manipulation of effect collections in safe effect systems. We prove the type-and-effect safety of ${λ_{\mathrm{EA}}}$ by assuming that a given effect algebra meets certain properties called safety conditions. As a result, we can obtain the safety properties of a concrete effect system by proving that an effect algebra corresponding to the concrete system meets the safety conditions. We also show that effect algebras meeting the safety conditions are expressive enough to accommodate some existing effect systems, each of which represents effect collections in a different style. Our framework can also differentiate the safety aspects of the effect collections of the existing effect systems. To this end, we extend ${λ_{\mathrm{EA}}}$ and the safety conditions to lift coercions and type-erasure semantics, propose other effect algebras including ones for which no effect system has been studied in the literature, and compare which effect algebra is safe and which is not for the extensions.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑