Affiliation:
1. IMDEA Software Institute, Spain / Universidad Politécnica de Madrid, Spain
2. IMDEA Software Institute, Spain
Abstract
Programming languages with algebraic effects often track the computations’ effects using type-and-effect systems. In this paper, we propose to view an algebraic effect theory of a computation as a variable context; consequently, we propose to track algebraic effects of a computation with
contextual modal types
. We develop ECMTT, a novel calculus which tracks algebraic effects by a contextualized variant of the modal □ (necessity) operator, that it inherits from Contextual Modal Type Theory (CMTT).
Whereas type-and-effect systems add effect annotations on top of a prior programming language, the effect annotations in ECMTT are inherent to the language, as they are managed by programming constructs corresponding to the logical introduction and elimination forms for the □ modality. Thus, the type-and-effect system of ECMTT is actually just a type system.
Our design obtains the properties of local soundness and completeness, and determines the operational semantics solely by β-reduction, as customary in other logic-based calculi. In this view, effect handlers arise naturally as a witness that one context (i.e., algebraic theory) can be reached from another, generalizing explicit substitutions from CMTT.
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.
Funder
Ministerio de Ciencia, Innovación y Universidades
European Research Council
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference56 articles.
1. Handling fibred algebraic effects
2. Asynchronous effects
3. Categorical and Kripke Semantics for Constructive S4 Modal Logic
4. Andrej Bauer. 2018. What is algebraic about algebraic effects and handlers? arXiv preprint arxiv:1807.05923v2 Andrej Bauer. 2018. What is algebraic about algebraic effects and handlers? arXiv preprint arxiv:1807.05923v2
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献