Retrofitting Effect Handlers to OCaml

09 Dec 2020

Talk Recording

Access Passcode: f8tP^Eep

Speaker

KC Sivaramakrishnan (IIT Madras)

Abstract

Effect handlers have been gathering momentum as a mechanism for modular programming with user-defined effects. Effect handlers allow for non-local control flow mechanisms such as generators, async/await, lightweight threads and coroutines to be composably expressed. The Multicore OCaml project retrofits effect handlers to the OCaml programming language to serve as a modular basis of concurrent programming. This is challenging since OCaml does not currently have any non-local control flow mechanisms other than exceptions. Non-local control operators and programming with resources interact in subtle ways. In this talk, I will introduce effect handlers in OCaml, walk through several examples that illustrate their utility, describe the retrofitting challenges and how we overcome them without breaking existing OCaml code. Our implementation imposes negligible overhead on code that does not use effect handles and is efficient for code that does. Effect handlers are slated to land in OCaml after the addition of parallelism support.

Speaker Bio

Bio: “KC” Sivaramakrishnan is an Assistant Professor in the Department of Computer Science and Engineering at IIT, Madras, India, where he works on the intersection of programming languages and systems. His goal is to progressively improve practical software systems with better abstractions and pragmatic verification. He leads the Multicore OCaml project, which aims to bring native support for concurrency and parallelism to OCaml. He previously developed MultiMLton, a multicore extension of the MLton standard ML compiler and lightweight concurrency abstractions for the Glasgow Haskell Compiler. Before IIT Madras, KC was a Senior Research Fellow at the University of Cambridge and obtained his PhD at Purdue University, with stints in Microsoft Research Cambridge and Samsung Research America.