OCaml Effects

I’ve been interested in algebraic effects in programming languages for a while, but they’ve been theoretical-only for a while. That’s soon to change though!

OCaml early on adopted algebraic effects and handlers as a way to implement concurrency, something that had been lacking in the language until now. But changing the langugage’s memory model, runtime, garbage collector, etc. proved to be a long task.

OCaml 5.0 is on the horizon at last and includes an implementation of algebraic effects. Unfortunately, I couldn’t find any good tutorials on the version of effect handlers in 5.0. I found a really good tutorial from 5 years ago that was based on a proposed version of OCaml effects, but nothing modern.

So I updated the 5 year old tutorial to use the 5.0 version of Effect module. This was tested on OCaml version 5.0.0~beta1 and I hope it helps people get started using OCaml effects! The updated tutorial can be found on GitHub

Update: This has been merged into upstream! Find it here: https://github.com/ocamllabs/ocaml-effects-tutorial