~> () fun smtpClient(c, from, to, msg) { var c1 = select EHLO c; var c2 = send(getDomain(from), c1); var c3 = send(from, c2); var c4 = send(to, c3); var c5 = send(message, c4) var c6 = select QUIT c5; close c6 } great introduction to session types by Simon Fowler: http:/ /simonjf.com/2016/05/28/session-type-implementations.html Tiny example of implementing SMTP: Implementation of the client: (Implemented in Links)