Reactive: Design and Implementation of a synchronous reactive programming library in Effekt

Reactive systems are an important part of everyday programming. Still, the implementations of such reactive systems differ hugely, which has a major impact on the style and reliability of reactive programs. The main approach to implementing reactivity and parallelism in the industry is to use multi-threading. This approach often leads to non-deterministic behavior. Additionally, programming languages often need extra implementations for reactivity and parallelism to support multi-threading. Languages such as Effekt eradicate the need for additional reactive system language support, by implementing algebraic effects. With algebraic effects, it is possible to implement a vast amount of programs, including reactive systems. In this work, we present Reactive, a library for the programming language Effekt. Reactive uses algebraic effects to implement reactivity and parallelism in direct style. The ability to write programs in direct style leads to more readable code, as it appears to be sequential, while the control flow is handled with algebraic effects. Reactive defines a synchronous execution model, by interleaving waiting parts of the program. The synchronous approach of the library makes decisions over the execution flow of the program deterministic. Parallelism and reactivity are decoupled by using different effects and handlers. With schedulers, Reactive creates the ability to run parts of a program in parallel. Reactive implements different schedulers, which handle the control flow of the program by enforcing rules. Such rules can be the termination of parts of the program when another has already stopped. The awaiting of an event is done by polling an environment in a busy wait loop, which can be interleaved with other parts of the program. Additional to the Effekt implementation, this thesis implements the ability to wait for JavaScript events inside the Effekt language.

Contact

Jonathan Brachthäuser

Philipp Schuster