处理多态代数效应
Handling polymorphic algebraic effects
摘要:
代数效果和处理程序是表示和实现控制效果的强大抽象机制。在这项工作中,我们研究了他们的扩展参数多态性,允许抽象不仅表达式,而且效果和处理程序。虽然多态性使得更有效地重用和推理效果实现成为可能,但人们早就知道多态效果和let多态性的天真组合会破坏类型安全。虽然类型安全通常可以通过限制let绑定表达式来获得-例如,通过采用值限制或弱多态性-我们提出了一种补充方法,限制处理程序而不是let绑定表达式。我们的主要观察是,非正式地说,如果来自处理程序的请求不相互干扰,则处理程序是安全的。为了形式化我们的想法,我们定义了一个按值调用的λ演算,支持let多态和多态代数效果和处理程序,设计了一个类型系统,拒绝干扰处理程序,并证明我们的演算的类型安全。
英文摘要:
Algebraic effects and handlers are a powerful abstraction mechanism to represent and implement control effects. In this work, we study their extension with parametric polymorphism that allows abstracting not only expressions but also effects and handlers. Although polymorphism makes it possible to reuse and reason about effect implementations more effectively, it has long been known that a naive combination of polymorphic effects and let-polymorphism breaks type safety. Although type safety can often be gained by restricting let-bound expressions---e.g., by adopting value restriction or weak polymorphism---we propose a complementary approach that restricts handlers instead of let-bound expressions. Our key observation is that, informally speaking, a handler is safe if resumptions from the handler do not interfere with each other. To formalize our idea, we define a call-by-value lambda calculus that supports let-polymorphism and polymorphic algebraic effects and handlers, design a type system that rejects interfering handlers, and prove type safety of our calculus.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。