Skip to main content

Message passing with effect handlers

Supervisors

Suitable for

Computer Science, Part B

Abstract

Prerequisites: Some functional programming experience

Background

 

Effect handlers are a programming construct designed to enable programmers to implement computational effects (e.g. raising an exception, mutating state) in a modular way. The main application so far has been to concurrent programming. Effect handlers have now been added to the OCaml language [1], there has been recent work on effect handlers for WebAssembly [2] and for C++ [3], and there are various research languages based around them (e.g. Eff [4], Effekt [5], and Koka [6]).

Focus

 

This project aims to explore the use of effect handlers to implement message-passing concurrency, where threads can send messages to each other. The primary goal would be to implement handlers for message-passing, and to evaluate them using some examples of message-passing programs. Extensions could include exploring session types with handlers, or looking at the formal semantics.

 

Method

 

You would take some existing language with effect handlers (e.g. OCaml, or one of the research languages mentioned above), and implement some effect handlers with operations for sending and receiving messages, along with some basic concurrency primitives. These languages all have examples of concurrency primitives using effect handlers, which you can use as a starting point. You would then implement some examples of concurrent message-passing programs and explore some improvements to your effect handler implementation. The examples would serve as a way to evaluate your implementations.

 

[1] https://ocaml.org/manual/5.2/effects.html

[2] https://wasmfx.dev/

[3] https://github.com/maciejpirog/cpp-effects

[4] https://www.eff-lang.org/

[5] https://effekt-lang.org/

[6] https://koka-lang.github.io/