论文标题
明确的效果亚型
Explicit Effect Subtyping
论文作者
论文摘要
随着代数效应和处理程序的普及,对其有效执行的需求也增加了。 EFF是一种具有本机支持处理程序的ML式语言,具有基于亚型的效应系统,可以在该系统上构建效果感知的优化编译器。不幸的是,根据我们的经验,对EFF实施优化非常容易出错,因为其核心语言被隐含地构成,从而使代码转换非常脆弱。 为了解决这个问题,我们提出了一个具有基于亚型类型和效应系统的代数效应处理程序的显式多态性核心演算。它可以用胁迫的强制性来实现细分证明,并迅速暴露在程序转换中的键入错误。 我们的打字指导的详细说明具有基于约束的推理算法,该算法将隐式类似的EFF样语言变成了我们的演算。此外,所有胁迫和效果信息都可以直接删除,表明胁迫没有计算内容。此外,我们使用效应信息仅在必要时才引入莫尼达构建体,将微积分转换为无代数效应或处理程序的纯语言的单调翻译。
As popularity of algebraic effects and handlers increases, so does a demand for their efficient execution. Eff, an ML-like language with native support for handlers, has a subtyping-based effect system on which an effect-aware optimizing compiler could be built. Unfortunately, in our experience, implementing optimizations for Eff is overly error-prone because its core language is implicitly-typed, making code transformations very fragile. To remedy this, we present an explicitly-typed polymorphic core calculus for algebraic effect handlers with a subtyping-based type-and-effect system. It reifies appeals to subtyping in explicit casts with coercions that witness the subtyping proof, quickly exposing typing bugs in program transformations. Our typing-directed elaboration comes with a constraint-based inference algorithm that turns an implicitly-typed Eff-like language into our calculus. Moreover, all coercions and effect information can be erased in a straightforward way, demonstrating that coercions have no computational content. Additionally, we present a monadic translation from our calculus into a pure language without algebraic effects or handlers, using the effect information to introduce monadic constructs only where necessary.