处理代数效应
Handling Algebraic Effects
摘要:
代数效应是可以用方程理论表示的计算效应,方程理论的运算产生了手头的效应。这个理论的自由模型为相应的效应导出了预期的计算单子。代数效应包括异常、状态、非确定性、交互式输入/输出和时间,以及它们的组合。然而,异常处理到目前为止还没有得到代数处理。我们提出了这样的治疗,其中每个处理程序产生的理论模型的例外,每个处理构造产生的自由模型的普遍属性诱导的同态。我们进一步概括异常处理程序的任意代数效果。由此产生的编程结构包括许多以前不相关的例子,从理论和实践,包括重新标记和限制在米尔纳的CCS,超时,回滚,和流重定向。
英文摘要:
Algebraic effects are computational effects that can be represented by an equational theory whose operations produce the effects at hand. The free model of this theory induces the expected computational monad for the corresponding effect. Algebraic effects include exceptions, state, nondeterminism, interactive input/output, and time, and their combinations. Exception handling, however, has so far received no algebraic treatment. We present such a treatment, in which each handler yields a model of the theory for exceptions, and each handling construct yields the homomorphism induced by the universal property of the free model. We further generalise exception handlers to arbitrary algebraic effects. The resulting programming construct includes many previously unrelated examples from both theory and practice, including relabelling and restriction in Milner's CCS, timeout, rollback, and stream redirection.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。