Introduction to Lwt

Hello,

I’ve published https://raphael-proust.github.io/code/lwt-part-1.html, 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.

18 Likes

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:
https://raphael-proust.gitlab.io/code/lwt-part-3.html#addendum-non-obvious-evaluation-order

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.

4 Likes