Effective Programming in OCaml
summary
Retrofitting Multicore OCaml adds effect handlers as first-class user-defined effects with one-shot delimited continuations and continue/discontinue primitives, transparently turning synchronous IO and iterators into nonblocking code. Implementation uses per-fiber small stacks, continuation objects and an event loop integration that preserves exceptions and GDB/perf support. Benchmarks show effect-based generators run ~9× slower than a hand‑CPS optimized version (JavaScript generators are ~90× slower vs iterators), while a full HTTP server matches Go and LWT throughput.
AI-written summary · about
chapters (12)
- 0:00Multicore OCaml intro
- 3:38OCaml needs effect handlers
- 9:10Effect handlers in Multicore OCaml
- 12:44Lightweight threading scheduler
- 16:35Direct style concurrency
- 17:18Generators with effect handlers
- 21:30Backwards compatibility
- 25:23Resource safety with effects
- 27:29Effect handlers overhead
- 29:13Benchmarking generators
- 30:13Web server in direct style
- 31:35Conclusion
related talks
46mFunctional effects in perspective
26mAn Invitation to OCaml
58mEffect-Oriented Programming
31mPick a (Effect) Lane: A comparison of direct-style Scala vs effect systems
14mFundamentalist Functional Programming
43mThe Design of the Scalaz 8 Effect System
46mSimple Functional Effects with Tag Unions
23mTempo: Reconstructing Synchronous Reactive Programming with OCaml 5 Effects
