Sessions
YOW! Brisbane 2022

Monday Dec 5
14:30 –
15:20
Green Room

Simple Functional Effects with Tag Unions

There are many ways a programming language can support effects. For many years, side effects were the only game in town. Today, there are a variety of ways to model effects in a more functional way, with each effect system having its own set of tradeoffs.

This talk introduces a simple, high-performance effect system based on tag unions - which can be implemented in the Roc programming language, as well as in OCaml using polymorphic variants. The system allows for easily mixing I/O operations that can fail in different ways (such as HTTP requests and file I/O), while still offering exhaustiveness checking on all the error cases. It also makes it easy to tell which functions are using which effects (for example, "this part of the code base does HTTP and reads from the filesystem, but is guaranteed not to write to the filesystem"), and to enforce at compile time that certain calls may result in some effects but not others.

If you're interested in a simple, high-performance effect system with these characteristics, come see what it's all about in this talk!