Computer Science > Programming Languages
[Submitted on 4 Mar 2021 (this version), latest version 22 Aug 2021 (v2)]
Title:Contextual Modal Types for Algebraic Effects and Handlers
View PDFAbstract: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.
Submission history
From: Nikita Zyuzin [view email][v1] Thu, 4 Mar 2021 11:50:25 UTC (96 KB)
[v2] Sun, 22 Aug 2021 15:54:30 UTC (108 KB)
References & Citations
Bibliographic and Citation Tools
Bibliographic Explorer (What is the Explorer?)
Connected Papers (What is Connected Papers?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)
Code, Data and Media Associated with this Article
alphaXiv (What is alphaXiv?)
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Hugging Face (What is Huggingface?)
Papers with Code (What is Papers with Code?)
ScienceCast (What is ScienceCast?)
Demos
Recommenders and Search Tools
Influence Flower (What are Influence Flowers?)
CORE Recommender (What is CORE?)
arXivLabs: experimental projects with community collaborators
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.