Contextual modal types for algebraic effects and handlers

@article{Zyuzin2021ContextualMT,
  title={Contextual modal types for algebraic effects and handlers},
  author={Nikita Zyuzin and Aleksandar Nanevski},
  journal={Proceedings of the ACM on Programming Languages},
  year={2021},
  volume={5},
  pages={1 - 29}
}
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… 

Figures from this paper

A Categorical Normalization Proof for the Modal Lambda-Calculus

A normalization by evaluation (NbE) algorithm for λ → (cid:3) which is sound and complete and lays the foundation for extending the logical foundation by Pfenning, Wong, and Davies towards building a practical, dependently typed foundation for meta-programming.

Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back

System C is presented, which builds on and generalizes ideas from type-based escape analysis and demonstrates that capabilities and effects can be reconciled harmoniously.

Curry and Howard Meet Borel

We show that an intuitionistic version of counting propositional logic corresponds, in the sense of Curry and Howard, to an expressive type system for the probabilistic event λ-calculus, a vehicle

References

SHOWING 1-10 OF 70 REFERENCES

Handling fibred algebraic effects

  • D. Ahman
  • Computer Science
    Proc. ACM Program. Lang.
  • 2018
This work gives handlers a novel type-based treatment via a new computation type, the user-defined algebra type, which pairs a value type with a set of value terms (the operations), capturing Plotkin and Pretnar's insight that effect handlers denote algebras.

A modal calculus for effect handling

A general framework for effect handling systems is developed, and novel calculi for exceptions, catch-and-throw and composable continuations as specific instantiations are obtained.

Abstracting algebraic effects

This paper introduces and examines programming language constructs that back adoption of programming with algebraic effects on a larger scale in a modular fashion by providing mechanisms for abstraction and presents an experimental programming language based on this calculus, which provides strong abstraction mechanisms via an ML-style module system.

Liberating effects with rows and handlers

This paper argues that the abstraction required to implement extensible effects and their handlers is exactly row polymorphism, and presents a core calculus of row-polymorphic effects and handlers based on a variant of A-normal form used in the intermediate representation of Links.

Quantitative program reasoning with graded modal types

This work proposes the umbrella notion of graded modal types, encompassing coeffect types and dual notions of type-based effect reasoning via graded monads, and demonstrates this approach via a type system embodied in a fully-fledged functional language called Granule.

From dynamic binding to state via modal possibility

A typed, purely functional calculus for state (with second-class locations) in which types reflect the dichotomy between reading from and writing into the global store, in contrast to the usual formulation of state via monads.

Programming with algebraic effects and handlers

Handling Algebraic Effects

This work generalises exception handlers to arbitrary algebraic effects, and includes many previously unrelated examples from both theory and practice, including relabelling and restriction in Milner's CCS, timeout, rollback, and stream redirection.

Type directed compilation of row-typed algebraic effects

This article shows how algebraic effects generalize over common constructs like exception handling, state, iterators and async-await, and gives an effective type inference algorithm based on extensible effect rows using scoped labels, and a direct operational semantics.

An Effect System for Algebraic Effects and Handlers

An effect system for algebraic effects and handlers is presented, based on a domain-theoretic model with partial equivalence relations, which validates equational reasoning about effectful computations.
...