Introduction to Lwt


I’ve published, a 2-part introduction to Lwt.

The main aim of the introduction is to give a good mental model of what promises are, how they behave and how to use them. It assumes basic familiarity with OCaml.

Don’t hesitate to ask questions or share feedback.


I had a long discussion about a very tiny bit of code and specifically about the yielding behaviour/execution order within the Lwt part of the code. So I made an small addendum to the tutorial:

It highlights how the behaviours of bind and wakeup interact. It also waffles on a bit about how pause and run interact. The behaviours of all these functions were already described in the post. In that sense the addendum does not bring any new information. However, it does point out some emergent (and, some would say, surprising) behaviours when the functions are combined.

Anyone interested in the very minutia of scheduling might be interested in reading through the addendum.