Haai
Reactive programming without lifting.

Publications

A Graph-Based Formal Semantics of Reactive Programming from First Principles

Presented at FTfJP 2022.

Abstract

In recent years, stream processing has become the de facto paradigm to process any kind of real-time data in many kinds of applications. Different libraries, frameworks and techniques exists which aim to make it easy to build stream processing applications in many modern programming languages... Libraries such as Reactive Extensions, Akka Streams, or web frameworks such as React and Vue are all based on the idea of data streams that are connected to graphs to model the flow of data in applications. To the best of our knowledge, there exist no formalism which captures the essential core semantics of these approaches in a straightforward, easy to understand, manner: namely its graph-based program structure and the turn-based propagations of values through this graph. In this paper, we present Karcharias, a formalisation of reactive programming (a paradigm that shares many core ideas found in the various aforementioned libraries and frameworks) that is built from first principles. Instead of extending an existing language with a graph-based stream processing framework, and formalising this integrated language, we formalised the reactive programming paradigm without relying on a base language (e.g., the λ-calculus). Using our formalism, we show how reactive programs (and thus, stream-based programs in general) need a way to construct a graph and to propagate events through that graph, even in the absence of a base language.

  • Links pending

Trampoline Variables: A General Method for State Accumulation in Reactive Programming

Presented at REBLS 2021.

Abstract

Reactive programming is all about relegating the management of a program's state changes to the realm of the runtime environment. Nevertheless, sometimes it is still necessary to enrich a reactive program with state variables that are explicitly updated by the programmer. In current reactive languages this is accomplished either by polluting the reactive paradigm with imperative constructs or by relying on built-in operators such as foldp. This paper introduces trampoline variables, a new general mechanism that allows reactive programs to manipulate state explicitly without resorting to imperative programming. We show that our proposal is at least as powerful as existing built-in reactive operators. We also analyse how reactive programs with trampoline variables can be composed and how they can form the basis to replace stateful constituents of a running reactive program - a.k.a. hotswapping - in a coherent way. The latter is an essential building block towards live IDEs for reactive programming languages.

Reactive Sorting Networks

Presented at REBLS 2020.

Abstract

Sorting is a central problem in computer science and one of the key components of many applications. To the best of our knowledge, no reactive programming implementation of sorting algorithms have ever been presented. In this paper we present a reactive implementation of so-called sorting networks. Sorting networks are networks of comparators that are wired-up in a particular order. Data enters a sorting network along various input wires and leaves the sorting network on the same number of output wires that carry the data in sorted order. This paper shows how sorting networks can be expressed elegantly in a reactive programming language by aligning the visual representation of a sorting network with the canonical DAG representation of reactive programs. We use our own experimental language called Haai to do so. With a limited number of built-in higher-order reactive programs, we are able to express sorting networks for bubble sort, insertion sort, bitonic sort, pairwise sort and Batcher’s odd-even merge sort.

Composable Higher-Order Reactors as the Basis for a Live Reactive Programming Environment

Presented at REBLS 2018.

Abstract

A live programming environment allows programmers to edit programs while they are running. This means that successive "edit steps" must not allow a programmer to bring the program in a form that does not make any sense to the underlying language processor (i.e., parser, compiler,...). Many live programming environments therefore rely on disciplined edit steps that are based on language elements such as objects, classes, and methods. Textual modifications to these elements are not seen as edit steps until some "accept" button is hit. Unfortunately, no such elements exist in current reactive languages. We present a new reactive language, called Haai, that is based on first-class higher-order reactors. Linguistically, Haai programs correspond to reactors or compositions of reactors. At run-time, reactors produce an infinite stream of values just like signals and behaviours in existing languages. Haai’s live programming environment relies on textual modifications of entire reactors as its basic edit steps. Changing a reactor automatically updates all occurrences of that reactor in the reactive program, while it is running.