I too am not entirely convinced about direct-style programming for concurrent systems. It’s useful to simplify signatures and avoid some functors with type 'a io := 'a Lwt.t
, but signatures become less informative overall.
That being said, Lwt is not great in that respect: type information only vaguely relates to interleavings. Specifically, you can have “interleavings” without the Lwt.t
type showing up (see this long explanation), and you can have the Lwt.t
type show up without any “interleavings” (See this short explanation). (I’m putting interleaving in quotes because it’s a concept of threads which is not actually a thing in Lwt.)
As far as I know Async is more accurate with that regards. (I don’t know if it’s fully accurate, but more than Lwt.)
Still, Lwt offers some type hints relating to yielding. And those hints are useful.