The use-case for typestate or session types is very compelling to me, as it makes it possible to encode the correct order of a protocol in the type-system. What changes would be required to the OCaml type system to make session types (or some kind of typestate) idiomatic enough to be included in the standard library?
There are a lot of papers available on OCaml and session types. They all rely on either passing the session around manually and explicitly, or wrapping it in a monad (lenses etc) with some light syntax extension. The key point being to check everything during compilation and not runtime. From a quick glance, this all seems quite laborious, and prevent the technique to be widely used.
Is there any low-hanging fruit available to change to OCaml type system, to make typestate or session types more idiomatic and
Edit: Also a previous discussion on this forum: Is there a good way to encode linear types in OCaml?