# Effects++, June 2017

It has been a busy couple of months in the effect handlers biz. The state of effects has been incremented quite a bit. Amongst the recent increments are some of my own work.

Expressivity study Yannick Forster, Ohad Kammar, Sam Lindley, and Matija Pretnar got their paper accepted for publication at ICFP'17:

The title pretty much sums it up: using Felleisen's notion of macro expressivity they establish formal connections between the three different control mechanisms effect handlers, monadic reflection, and shift0/reset. They begin by developing a language called multi-adjunctive metalanguage (MAM) which is a lambda calculus with call-by-push-value semantics and a polymorphic type system with a simple effect system. They take MAM as their basis, in turn augmenting it with the three different control mechanisms.

Systems programming with handlers Towards the end of April I spent some time hacking on the Multicore OCaml compiler at OCaml Labs in Cambridge. Stephen Dolan, Spiros Eliopoulos, Anil Madhavapeddy, KC Sivaramakrishnan, Leo White, and I put together various bits of work we had done over the past year or so. We wrote it up as a draft paper:

In this draft we argue that effect handlers provide a compelling abstraction for systems programming, providing a direct-style alternative to the predominant callback style programming without sacrificing performance. We evaluate the claim by implementing a web server using effect handlers. We also present an approach to scoped signal handling using asynchronous effects. Stephen presented the draft paper at Trends in Functional Programming this week in Canterbury. Last week I gave brief 10-minute talk about paper during the CDT Pervasive Parallelism Student Showcase event. We also submitted a 2-page version of the paper to the ML Workshop:

The title is a play on Simon Peyton Jones' Tackling the Awkward Squad: monadic input/ouput, concurrency, exceptions, and foreign-language calls in Haskell.

NII Shonan seminar During May I attended the NII Shonan Seminar 103: Semantics of Effects, Resources, and Applications in Japan. The photograph above is a group photo taken during the seminar. The seminar consisted of an alternating series of theoretical and practical flavoured lectures. After the seminar I spent some time travelling around Kanagawa prefecture.

CPS translations for handlers Last week I received the notification that my paper with Sam Lindley, Bob Atkey, and KC Sivaramakrishnan has been accepted for publication in FSCD'17:

Incidentally, this is my first international conference publication, so needless to say that I am very excited about it. In the paper we develop several continuation passing style (CPS) translations for effect handlers. Our main contribution is a higher-order CPS translation of effect handlers, which can be regarded as an improvement over Daan Leijen's (selective) CPS translation for effect handlers in Koka which requires the compilation target to retain some fellow primitive. The novelty of our translation is that it does not have impose this restriction on the target, making it possible to compile directly to the vanilla Lambda calculus. At the moment I am working on the camera-ready version. I will be presenting the paper during the conference which takes place in Oxford during September.

Asynchrony and handlers in C Speaking of Daan, he has two recent technical reports:

In the former paper, Daan uses effect handlers to reconstruct the popular async-await programming construct as a library. The async-await construct can be found in many contemporary programming languages such as C# and JavaScript. I find this reconstruction interesting, because it exemplifies that effect handlers capture rather complex control-flow abstractions which are typically given special support by the compiler. The latter report implements effect handlers as a library in the good ol' C programming language. The construction of handlers is somewhat unhandy, however, Daan mentions that he envisages the library to used as a compilation target rather than by the everyday C programmer.