Proceedings paper

Coeffects: a calculus of context-dependent computation
T. Petříček, D. Orchard, A. Mycroft
Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming

The notion of context in functional languages no longer refers just to variables in scope. Context can capture additional properties of variables (usage patterns in linear logics; caching requirements in dataflow languages) as well as additional resources or properties of the execution environment (rebindable resources; platform version in a cross-platform application). The recently introduced notion of coeffects captures the latter, whole-context properties, but it failed to capture fine-grained per-variable properties. We remedy this by developing a generalized coeffect system with annotations indexed by a coeffect shape. By instantiating a concrete shape, our system captures previously studied flat (whole-context) coeffects, but also structural (per-variable) coeffects, making coeffect analyses more useful. We show that the structural system enjoys desirable syntactic properties and we give a categorical semantics using extended notions of indexed comonad. The examples presented in this paper are based on analysis of established language features (liveness, linear logics, dataflow, dynamic scoping) and we argue that such context-aware properties will also be useful for future development of languages for increasingly heterogeneous and distributed platforms.

    title = {{Coeffects: a calculus of context-dependent computation}},
    author = {Petricek, Tomas and Orchard, Dominic and Mycroft, Alan},
    year = {2014},
    booktitle = {{Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming}},
    publisher = {Association for Computing Machinery},
    series = {{ICFP '14}},
    location = {New York, NY, USA},
    doi = {10.1145/2628136.2628160},
    isbn = {978-1-4503-2873-9},
    pages = {123--135},
    shorttitle = {Coeffects},