Capturing the Future by Replaying the Past
James Koppel, Gabriel Scherer, Armando Solar-Lezama

TL;DR
This paper introduces thermometer continuations, a novel method to implement delimited continuations using exceptions and state by replaying computations, enabling monadic effects in languages lacking native support.
Contribution
It presents a new construction of delimited continuations from exceptions and state, expanding their applicability in programming languages.
Findings
Thermometer continuations can implement any monadic effect.
The method allows capturing intermediate states by replaying computations.
An elegant special-case for nondeterminism is provided.
Abstract
Delimited continuations are the mother of all monads! So goes the slogan inspired by Filinski's 1994 paper, which showed that delimited continuations can implement any monadic effect, letting the programmer use an effect as easily as if it was built into the language. It's a shame that not many languages have delimited continuations. Luckily, exceptions and state are also the mother of all monads! In this Pearl, we show how to implement delimited continuations in terms of exceptions and state, a construction we call . While traditional implementations of delimited continuations require some way of "capturing" an intermediate state of the computation, the insight of thermometer continuations is to reach this intermediate state by replaying the entire computation from the start, guiding it using a recording it so that the same thing happens until the…
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.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Logic, programming, and type systems · Computability, Logic, AI Algorithms
