Session types are a technique for using a rich type system, like that of Rust or OCaml, to prevent the representation of certain kinds of illegal states. Here, I’ll illustrate them with a (somewhat contrived) example. What is the use-case? Let’s take the example of a system representing packaging and shipping boxes. I want to create a Package data structure, pack data into it, close it (preventing adding data), address it, and then ship it. It makes no sense to send an un-addressed Packag...