Recovering Purity with Comonads and Capabilities
Vikraman Choudhury, Neel Krishnaswami

TL;DR
This paper introduces a comonadic type system for effectful lambda calculus to capture and reason about program purity using capabilities, supported by a categorical semantics and a translation from pure to effectful programs.
Contribution
It extends effectful lambda calculus with a comonadic discipline for purity, formalizes it with a capability space model, and provides a categorical semantics and translation from pure lambda calculus.
Findings
The type system correctly models purity via capabilities.
The categorical semantics formalizes the effect control mechanism.
Pure programs can be embedded into the effectful calculus preserving equality.
Abstract
In this paper, we take a pervasively effectful (in the style of ML) typed lambda calculus, and show how to extend it to permit capturing pure expressions with types. Our key observation is that, just as the pure simply-typed lambda calculus can be extended to support effects with a monadic type discipline, an impure typed lambda calculus can be extended to support purity with a comonadic type discipline. We establish the correctness of our type system via a simple denotational model, which we call the capability space model. Our model formalizes the intuition common to systems programmers that the ability to perform effects should be controlled via access to a permission or capability, and that a program is capability-safe if it performs no effects that it does not have a runtime capability for. We then identify the axiomatic categorical structure that the capability space model…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
