%0 Conference Proceedings %T Session-ocaml: A Session-Based Library with Polarities and Lenses %+ Gifu University %+ Imperial College London %+ Nagoya University %A Imai, Keigo %A Yoshida, Nobuko %A Yuen, Shoji %Z Part 3: Types %< avec comité de lecture %( Lecture Notes in Computer Science %B 19th International Conference on Coordination Languages and Models (COORDINATION) %C Neuchâtel, Switzerland %Y Jean-Marie Jacquet %Y Mieke Massink %I Springer International Publishing %3 Coordination Models and Languages %V LNCS-10319 %P 99-118 %8 2017-06-19 %D 2017 %R 10.1007/978-3-319-59746-1_6 %Z Computer Science [cs] %Z Computer Science [cs]/Networking and Internet Architecture [cs.NI]Conference papers %X We propose session-ocaml, a novel library for session-typed concurrent/distributed programming in OCaml. Our technique solely relies on parametric polymorphism, which can encode core session type structures with strong static guarantees. Our key ideas are: (1) polarised session types, which give an alternative formulation of duality enabling OCaml to automatically infer an appropriate session type in a session with a reasonable notational overhead; and (2) a parameterised monad with a data structure called ‘slots’ manipulated with lenses, which can statically enforce session linearity and delegations. We show applications of session-ocaml including a travel agency usecase and an SMTP protocol. %G English %Z TC 6 %Z WG 6.1 %2 https://inria.hal.science/hal-01657342/document %2 https://inria.hal.science/hal-01657342/file/450044_1_En_6_Chapter.pdf %L hal-01657342 %U https://inria.hal.science/hal-01657342 %~ IFIP-LNCS %~ IFIP %~ IFIP-TC %~ IFIP-WG %~ IFIP-TC6 %~ IFIP-WG6-1 %~ IFIP-COORDINATION %~ IFIP-LNCS-10319