Ferrite: A Judgmental Embedding of Session Types in Rust
This article introduces Ferrite, a shallow embedding of session types in Rust. In contrast to existing session type libraries and embeddings for mainstram languages Ferrite not only supports linear session types but also shared session types. Shared session types allow sharing (aliasing) of channels while preserving session fidelity (preservation) using type modalities for acquiring and releasing sessions. Ferrite adopts a propositions as types approach and encodes typing derivations as Rust functions, with the proof of successful type-checking manifesting as a Rust program. The encoding resides entirely within the safe fragment of Rust and makes use of type-level features to support an arbitrary-length linear resource context and recursive session types.
READ FULL TEXT