Affiliation:
1. SUNY Buffalo, USA
2. Kyoto University, Japan
3. University of Cambridge, UK / University of Kent, UK
4. Inria, France
5. Tallinn University of Technology, Estonia
Abstract
Effects and coeffects are two general, complementary aspects of program behaviour. They roughly correspond to computations which change the execution context (effects) versus computations which make demands on the context (coeffects). Effectful features include partiality, non-determinism, input-output, state, and exceptions. Coeffectful features include resource demands, variable access, notions of linearity, and data input requirements. The effectful or coeffectful behaviour of a program can be captured and described via type-based analyses, with fine grained information provided by monoidal effect annotations and semiring coeffects. Various recent work has proposed models for such typed calculi in terms of graded (strong) monads for effects and graded (monoidal) comonads for coeffects. Effects and coeffects have been studied separately so far, but in practice many computations are both effectful and coeffectful, e.g., possibly throwing exceptions but with resource requirements. To remedy this, we introduce a new general calculus with a combined effect-coeffect system. This can describe both the changes and requirements that a program has on its context, as well as interactions between these effectful and coeffectful features of computation. The effect-coeffect system has a denotational model in terms of effect-graded monads and coeffect-graded comonads where interaction is expressed via the novel concept of graded distributive laws. This graded semantics unifies the syntactic type theory with the denotational model. We show that our calculus can be instantiated to describe in a natural way various different kinds of interaction between a program and its evaluation context.
Funder
Engineering and Physical Sciences Research Council
JSPS KAKENHI
Estonian Ministry of Education and Research
Estonian Science Foundation
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
36 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Diagrammatic Algebra of First Order Logic;Proceedings of the 39th Annual ACM/IEEE Symposium on Logic in Computer Science;2024-07-08
2. Numerical Fuzz: A Type System for Rounding Error Analysis;Proceedings of the ACM on Programming Languages;2024-06-20
3. Functional Ownership through Fractional Uniqueness;Proceedings of the ACM on Programming Languages;2024-04-29
4. Deciding Equations in the Time Warp Algebra;Logical Methods in Computer Science;2024-01-26
5. Program Synthesis from Graded Types;Lecture Notes in Computer Science;2024