Retrofitting Effect Handlers onto OCaml

04/01/2021
by   KC Sivaramakrishnan, et al.
0

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. We present a design and evaluate a full-fledged efficient implementation of effect handlers for OCaml, an industrial-strength multi-paradigm programming language. Our implementation strives to maintain the backwards compatibility and performance profile of existing OCaml code. Retrofitting effect handlers onto OCaml is challenging since OCaml does not currently have any non-local control flow mechanisms other than exceptions. Our implementation of effect handlers for OCaml: (i) imposes a mean 1 effect handlers; (ii) remains compatible with program analysis tools that inspect the stack; and (iii) is efficient for new code that makes use of effect handlers.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/18/2020

Handling Bidirectional Control Flow: Technical Report

Pressed by the difficulty of writing asynchronous, event-driven code, ma...
research
08/16/2023

Continuing WebAssembly with Effect Handlers

WebAssembly (Wasm) is a low-level portable code format offering near nat...
research
07/01/2020

Effects for Efficiency: Asymptotic Speedup with First-Class Control

We study the fundamental efficiency of delimited control. Specifically, ...
research
02/02/2023

A Framework for the Automated Verification of Algebraic Effects and Handlers (extended version)

Algebraic effects and handlers are a powerful abstraction to build non-l...
research
09/10/2020

Disjunctive Delimited Control

Delimited control is a powerful mechanism for programming language exten...
research
12/24/2019

Composable Effects for Flexible and Accelerated Probabilistic Programming in NumPyro

NumPyro is a lightweight library that provides an alternate NumPy backen...
research
11/29/2021

Enabling Reusable Physical Design Flows with Modular Flow Generators

Achieving high code reuse in physical design flows is challenging but in...

Please sign up or login with your details

Forgot password? Click here to reset