dc.contributor.author | Scherer, Gabriel | |
dc.contributor.author | Koppel, James Brandon | |
dc.contributor.author | Solar Lezama, Armando | |
dc.date.accessioned | 2018-08-16T15:26:52Z | |
dc.date.available | 2018-08-16T15:26:52Z | |
dc.date.issued | 2018-07 | |
dc.identifier.issn | 2475-1421 | |
dc.identifier.uri | http://hdl.handle.net/1721.1/117385 | |
dc.description.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 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 reflection, show how the Filinski construction lets thermometer continuations express any monadic effect, 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. | en_US |
dc.description.sponsorship | National Science Foundation (U.S.) (Grant 1122374) | en_US |
dc.language.iso | en_US | |
dc.publisher | Association for Computing Machinery (ACM) | en_US |
dc.relation.isversionof | http://dx.doi.org/10.1145/3236771 | en_US |
dc.rights | Creative Commons Attribution 4.0 International License | en_US |
dc.rights.uri | http://creativecommons.org/licenses/by/4.0/ | en_US |
dc.source | Prof. Solar-Lezama | en_US |
dc.title | Capturing the future by replaying the past (functional pearl) | en_US |
dc.type | Article | en_US |
dc.identifier.citation | Koppel, James et al. “Capturing the Future by Replaying the Past (functional Pearl).” Proceedings of the ACM on Programming Languages 2, ICFP (July 2018): 1–29 © 2018 The Authors | en_US |
dc.contributor.department | Massachusetts Institute of Technology. Department of Electrical Engineering and Computer Science | en_US |
dc.contributor.approver | Solar-Lezama, Armando | en_US |
dc.contributor.mitauthor | Koppel, James Brandon | |
dc.contributor.mitauthor | Solar Lezama, Armando | |
dc.relation.journal | Proceedings of the ACM on Programming Languages | en_US |
dc.eprint.version | Final published version | en_US |
dc.type.uri | http://purl.org/eprint/type/JournalArticle | en_US |
eprint.status | http://purl.org/eprint/status/PeerReviewed | en_US |
dspace.orderedauthors | Koppel, James; Scherer, Gabriel; Solar-Lezama, Armando | en_US |
dspace.embargo.terms | N | en_US |
dc.identifier.orcid | https://orcid.org/0000-0002-3948-6904 | |
dc.identifier.orcid | https://orcid.org/0000-0001-7604-8252 | |
mit.license | PUBLISHER_CC | en_US |