论文标题
处理高阶效果
Handling Higher-Order Effects
论文作者
论文摘要
代数效应处理程序是一个编程范式,程序员可以在其中声明自己的句法操作,并使用效果处理程序模块化定义这些语义的语义。 但是,我们无法直接定义许多高阶操作(或高阶效应)的代数效应处理程序,即具有计算作为参数的操作。 这种高阶效果的示例包括常见的编程功能,例如TryCatch异常处理程序,功能抽象等。 在本文中,我们提出了一种解决此缺点的新型效果处理程序。 我们的效应处理程序方法与以前在范围内的效果处理程序的工作密切相关,这也支持高阶效应。 一个关键的区别在于,我们的效果处理程序使其易于理解单独关注的单独关注(高阶)效果,因为效果不会相互作用。 相比之下,效应相互作用是默认的范围内效应处理程序。 尽管我们的处理程序默认是单独的担忧,但也可以定义效果相互作用的处理程序。
Algebraic effect handlers is a programming paradigm where programmers can declare their own syntactic operations, and modularly define the semantics of these using effect handlers. However, we cannot directly define algebraic effect handlers for many higher-order operations (or higher-order effects) -- i.e., operations that have computations as parameters. Examples of such higher-order effects include common programming features, such as try-catch exception handlers, function abstraction, and more. In this paper we present a new kind of effect handler that addresses this shortcoming. Our effect handler approach is closely related to previous work on scoped effect handlers, which also supports higher-order effects. A key difference is that our effect handlers make it easy to understand separate (higher-order) effects as separate concerns, since effects do not interact. In contrast, effect interaction is the default with scoped effect handlers. While separate concerns is the default with our handlers, it is also possible to define handlers where effects interact.