Service interruption on Monday 11 July from 12:30 to 13:00: all the sites of the CCSD (HAL, EpiSciences, SciencesConf, AureHAL) will be inaccessible (network hardware connection).
Skip to Main content Skip to Navigation
Journal articles

Capturing the Future by Replaying the Past Functional Pearl

James Koppel 1 Gabriel Scherer 2 Armando Solar-Lezama 1 
2 PARSIFAL - Proof search and reasoning with logic specifications
LIX - Laboratoire d'informatique de l'École polytechnique [Palaiseau], Inria Saclay - Ile de France
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 eeect, letting the programmer use an eeect 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 thermometer continuations. 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 so that the same thing happens until the captured point. Along the way, we explain delimited continuations and monadic reeection, show how the Filinski construction lets thermometer continuations express any monadic eeect, share an elegant special-case for nondeterminism, and discuss why our construction is not prevented by theoretical results that exceptions and state cannot macro-express continuations.
Document type :
Journal articles
Complete list of metadata

Cited literature [21 references]  Display  Hide  Download

https://hal.inria.fr/hal-01929178
Contributor : Scherer Gabriel Connect in order to contact the contributor
Submitted on : Wednesday, November 21, 2018 - 9:11:36 AM
Last modification on : Thursday, January 20, 2022 - 5:27:44 PM
Long-term archiving on: : Friday, February 22, 2019 - 1:00:47 PM

File

1710.10385.pdf
Files produced by the author(s)

Identifiers

Citation

James Koppel, Gabriel Scherer, Armando Solar-Lezama. Capturing the Future by Replaying the Past Functional Pearl. Proceedings of the ACM on Programming Languages, ACM, 2018, 2 (ICFP), pp.1 - 29. ⟨10.1145/3236771⟩. ⟨hal-01929178⟩

Share

Metrics

Record views

72

Files downloads

161