Delimited Continuations, Demystified
summary
GHC gains native first-class delimited continuations in GHC 9.6, implemented as a small runtime patch completed after a three‑year proposal cycle and finished while working at Tweag. The implementation represents continuations as sequences of stack-frame memcopy to the heap and back, captures delimited regions with prompt tags, and supports control/prompt (and thus algebraic‑effects style APIs). It works and is fast in practice, with caveats: continuations live in IO, lazy code limits use, possible space‑leak patterns, and OCaml-style one‑shot optimizations trade flexibility for performance.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 0:42History of delimited continuations
- 3:53First-class continuations
- 15:33Formalizing continuations
- 24:05Native delimited continuations
- 36:21Typing challenges
- 49:11Delimited continuations in Haskell
- 54:25Efficient GHC implementation
- 1:09:24Why GHC didn’t have delimited continuations earlier
- 1:14:39Summary
related talks
46mFunctional effects in perspective
32mEffective Programming in OCaml
32mFunctional Programming with Serialized Data
59mAn introduction to Continuation Passing Style (CPS)
01h 04mLinear Haskell, Today and Tomorrow
01h 04mHaskell - A Peek Inside the Ivory Tower
36mWorking Hard to Keep Things Lazy
51mStretching the Glasgow Haskell Compiler: Nourishing GHC with Domain-Driven De...
