Liberating Effects with Rows and Handlers

Daniel Hillerström, Sam Lindley

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract / Description of output

Algebraic effects and effect handlers provide a modular abstraction for effectful programming. They support user-defined effects, as in Haskell, in conjunction with direct-style effectful programming, as in ML. They also present a structured interface to programming with delimited continuations.
In order to be modular, it is necessary for an effect type system to support extensible effects. Row polymorphism is a natural abstraction for modelling extensibility at the level of types. In this paper we argue that the abstraction required to implement extensible effects and their handlers is exactly row polymorphism.
We use the Links functional web programming language as a platform to substantiate this claim. Links is a natural starting point as it uses row polymorphism for polymorphic variants, records, and its built-in effect types. It also has infrastructure for manipulating continuations. Through a small extension to Links we smoothly add support for effect handlers, making essential use of rows in the frontend and first-class continuations in the backend. We demonstrate the usability of our implementation by modelling the mathematical game of Nim as an abstract computation. We interpret this abstract computation in a variety of ways, illustrating how rows and handlers support modularity and smooth composition of effectful computations.
We present a core calculus of row-polymorphic effects and handlers based on a variant of A-normal form used in the intermediate representation of Links. We give an operational semantics for the calculus and a novel generalisation of the CEK machine that implements the operational semantics, and prove that the two coincide.
Original languageEnglish
Title of host publicationTyDe 2016 Proceedings of the 1st International Workshop on Type-Driven Development
PublisherACM
Pages15-27
Number of pages13
ISBN (Electronic)978-1-4503-4435-7
DOIs
Publication statusPublished - 18 Sept 2016
Event1st International Workshop on Type-Driven Development - Nara, Japan
Duration: 18 Sept 201624 Sept 2016
https://conf.researchr.org/home/icfp-2016/

Conference

Conference1st International Workshop on Type-Driven Development
Abbreviated titleICFP'16
Country/TerritoryJapan
CityNara
Period18/09/1624/09/16
Internet address

Fingerprint

Dive into the research topics of 'Liberating Effects with Rows and Handlers'. Together they form a unique fingerprint.

Cite this