Session Types in Programming Languages: A Collection of Implementations


Introduction

This page details implementations of session types. The list here is not restricted to tools produced by ABCD members. This list is currently maintained by Simon Fowler. Please get in touch if you wish to update this list with information about your tool.

This page was last updated on Tuesday 5th December 2017.

Categorising language-based implementations of session types

Binary vs. Multiparty

Are sessions between two participants (generally implemented as a typed channel with dual endpoints), or multiple?

Primitive vs. Library vs. External

What form do the session types take?

Static vs. Dynamic vs. Hybrid Verification

When and how is conformance to the session types checked?

Programming Languages with Native Session Types

ATS

(Static, Binary)

ATS is a programming language that aims to combine specification and implementation in a single language. ATS has many features, such as dependent and linear types, which allows the development of verified software. Recent work has integrated session-typed channels with ATS.

Resources

(Static, Binary)

Links is a programming language designed at the University of Edinburgh for developing “tierless” web applications. A recent extension of Links adds support for binary session types as language primitives.

Session types are checked fully statically, using an extension of the type system to support linear types. The repository contains a selection of examples.

Resources

MOOL

(Static, Object-based)

(Description from the MOOL website)

Mool is a mini object-oriented language in a Java-like style with support for concurrency, that allows programmers to specify class usage protocols as types. The specification formalizes (1) the available methods, (2) the tests clients must perform on the values returned by methods, and (3) the existence of aliasing and concurrency restrictions, all of which depend on the object’s state. Linear and shared objects are handled as a single category, allowing linear objects to evolve into shared ones. The Mool type system verifies that methods are called only when available, and by a single client if so specified in the usage type. Mool builds upon previous works on (Modular) Session Types and Linear Type Systems.

Resources

SePi

(Static, Binary)

(Description from the SePi website)

SePi is a concurrent, message-passing programming language based on the pi-calculus. The language features synchronous, bi-directional channel-based communication. Programs use primitives to send and receive messages as well as offer and select choices. Channel interactions are statically verified against session types describing the kind and order of messages exchanged, as well as the number of processes that may share a channel. In order to facilitate a more precise control of program properties, SePi includes assume and assert primitives at the process level and refinements at the type level. Refinements are treated linearly, allowing a finer, resource-oriented use of predicates: each assumption made supports exactly one an assertion.

Resources

SILL

(Static, Binary)

A programming language based on the intuitionistic linear logic view of session types.

Resources

Mainstream Languages with Implementations of Session Types

C

Multiparty Session C

(Static, Multiparty)

A statically-checked implementation of multiparty session types in C. Session communication happens using a runtime library, and type-checking is done via a clang plugin.

Resources

Erlang

monitored-session-erlang

(Dynamic, Multiparty, Actor-based)

An framework for monitoring Erlang/OTP applications by dynamically verifying communication against multiparty session types. Erlang actors can take part in multiple roles in multiple instances of multiple protocols.

The tool is inspired by the Session Actor framework of Neykova & Yoshida.

Resources

Go

DinGo Hunter

(External tool)

A static analyser for Go programs, which can statically detect deadlocks. The tool works by extracting CFSMs from Go programs, and attempting to synthesise a global graph. Should this fail, then there is a deadlock.

Resources

Gong

(External tool)

A more recent static analyser for Go, building on a minimal core calculus for Go called MiGo. MiGo types can be extracted from Go programs using another tool called GoInfer.

Given MiGo types obtained from GoInfer, Gong will check liveness and safety of communications.

Resources

Haskell

effect-sessions

(Static, Binary)

An implementation of session types in Concurrent Haskell, through the observation that session types can be encoded using an effect system (and vice versa).

Resources

simple-sessions

(Static, Binary)

A library implementation of Haskell session types, using parameterised monads and a channel stack.

Resources

sessions

(Static, Binary)

An alternative embedding of session types in Haskell.

Resources

GVInHS

(Static, Binary)

An embedding of session types in Haskell which (by virtue of a finally-tagless encoding) allows channels to be treated as first-class. Builds on Polakow’s embedding of a Linear Lambda-Calculus in Haskell.

Resources

Java

CO2 Middleware

(Dynamic, Binary, Timed)

Middleware for Java applications, based on the theory of timed session types. Supports dynamic monitoring of conformance to timing constraints.

Resources

(Eventful) Session Java

(Static, Binary, supports event-driven programming)

A frontend and runtime library for Java, supporting binary session types. The tool also supports event-driven programming.

Resources

Mungo / StMungo

(External, Multiparty)

Mungo is a tool which checks Java programs for conformance to typestate specifications, providing typestate inference. StMungo is a tool which translates Scribble protocols into typestate specifications.

Resources

Scribble Endpoint Generation

(Hybrid, Multiparty)

A tool which can generate endpoint APIs from Scribble protocols. The generated Java stubs allow message ordering to be checked statically, with linearity checked dynamically.

Resources

OCaml

FuSe

(Hybrid, Binary)

A very lightweight implementation of binary session types in OCaml, verifying message ordering statically and linearity violations dynamically.

Resources

Python

SPY

(Dynamic, Multiparty)

An implementation of multiparty session types in Python, using runtime monitoring.

Resources

Session Actor

(Dynamic, Multiparty, Actor-based)

A conceptual framework and Python implementation for extending session types to the actor model of programming. Each actor may be involved in multiple roles in multiple sessions. Communication is checked dynamically via compilation of Scribble protocols into CFSMs.

Resources

Rust

session-types

(Static, Binary)

An implementation of binary session types in Mozilla’s Rust language, making use of Rust’s affine typing system.

Resources

Scala

lchannels

(Hybrid, Binary)

An implementation of binary session types in Scala. The library uses the continuation-passing approach of Kobayashi, and Dardha et al. Message ordering is checked statically, and linearity is checked dynamically.

Resources