当前位置: X-MOL 学术arXiv.cs.PL › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Contextual Modal Types for Algebraic Effects and Handlers
arXiv - CS - Programming Languages Pub Date : 2021-03-04 , DOI: arxiv-2103.02976
Nikita Zyuzin, Aleksandar Nanevski

Programming languages with algebraic effects often rely on effect annotations to track algebraic operations in a computation. This is particularly important in the presence of effect handlers, where handling of an effect may remove it from the annotation in the computation's type. In this paper we view the algebraic effect theory of a computation as a variable context, and track the effects directly in computation's modal type with ECMTT, a novel calculus for algebraic effects and handlers. Our calculus supports computations with effects and derives from Contextual Modal Type Theory (CMTT), from which it inherits a number of important logical properties. In contrast to type-and-effect systems, where effects are attached as annotations to a prior computational language, ECMMT tracks effects by a contextualized variant of the modal $\Box$ (necessity) operator of the intuitionistic modal logic of CMTT. In programming, the effect annotations are explicitly managed by the dedicated term constructors corresponding to the logical introduction and elimination forms for the modality. The modal foundation leads to customary logical properties of local soundness and completeness, and determines the operational semantics of ECMTT directly by $\beta$-reduction. In addition, effect handlers become a generalization of explicit substitutions, which in CMTT serve to reach one context from another. To the best of our knowledge, ECMTT is the first system to relate algebraic effects to modal types. We also see it as a step towards providing a correspondence in the style of Curry and Howard that may transfer a number of results from the fields of modal logic and modal type theory to that of algebraic effects.

中文翻译:

代数效应和处理程序的上下文模态类型

具有代数效应的编程语言通常依赖于效应注解来跟踪计算中的代数运算。这在存在效果处理程序的情况下尤其重要,在这种情况下,对效果的处理可能会将其从计算类型的注释中删除。在本文中,我们将计算的代数效应理论视为变量上下文,并使用ECMTT(一种代数效应和处理程序的新型演算)直接在计算的模态类型中跟踪效应。我们的演算支持具有效果的计算,并从上下文模态类型理论(CMTT)派生而来,它从中继承了许多重要的逻辑属性。与类型和效果系统不同,类型和效果系统将效果作为注释附加到先前的计算语言上,ECMMT通过CMTT的直觉模态逻辑的模态$ \ Box $(必要)运算符的上下文变量来跟踪效果。在编程中,效果注释由专用术语构造函数显式管理,该专用术语构造函数与模态的逻辑介绍和消除形式相对应。模态基础导致局部健全性和完整性的习惯逻辑属性,并通过$ \ beta $ -reduction直接确定ECMTT的操作语义。另外,效果处理程序成为显式替换的泛化,在CMTT中,显式替换用于从另一个上下文到达一个上下文。据我们所知,ECMTT是第一个将代数效应与模态类型相关联的系统。
更新日期:2021-03-05
down
wechat
bug