Table of Contents
Fetching ...

Relational Reactive Programming: miniKanren for the Web

Evan Donahue

TL;DR

This work addresses the challenge of maintaining synchronized, bidirectional state between a web application's model and its view by marrying relational programming with front-end reactivity. It introduces a JavaScript-based reactive miniKanren, where a persistent substitution stores all data and reactive unification drives state transitions, while nondeterministic miniKanren search models dynamic views. Key contributions include a formalization of reactive unification, a patch-based update mechanism, and a view-tree strategy that preserves UI state through incremental updates, complemented by insertion-list representations for efficient DOM changes. The approach offers a principled, declarative alternative to traditional FRP and diff-based UIs, with potential for richer bidirectional programming patterns and future application-synthesis directions.

Abstract

Over the past decade, reactive frameworks and languages have become the dominant programming paradigm in front-end web development. In this paradigm, user actions change application state, and those changes propagate reactively to derived state and to the display, reducing the likelihood that various parts of the data model and user-facing view will become out of sync due to programmer error. In this paper, we explore the application of relational programming to the specification and synchronized evolution of model and view across time in response to user input. To that end, we present a reactive Javascript implementation of miniKanren and an integrated reactive programming model oriented towards the challenges of front-end web development.

Relational Reactive Programming: miniKanren for the Web

TL;DR

This work addresses the challenge of maintaining synchronized, bidirectional state between a web application's model and its view by marrying relational programming with front-end reactivity. It introduces a JavaScript-based reactive miniKanren, where a persistent substitution stores all data and reactive unification drives state transitions, while nondeterministic miniKanren search models dynamic views. Key contributions include a formalization of reactive unification, a patch-based update mechanism, and a view-tree strategy that preserves UI state through incremental updates, complemented by insertion-list representations for efficient DOM changes. The approach offers a principled, declarative alternative to traditional FRP and diff-based UIs, with potential for richer bidirectional programming patterns and future application-synthesis directions.

Abstract

Over the past decade, reactive frameworks and languages have become the dominant programming paradigm in front-end web development. In this paradigm, user actions change application state, and those changes propagate reactively to derived state and to the display, reducing the likelihood that various parts of the data model and user-facing view will become out of sync due to programmer error. In this paper, we explore the application of relational programming to the specification and synchronized evolution of model and view across time in response to user input. To that end, we present a reactive Javascript implementation of miniKanren and an integrated reactive programming model oriented towards the challenges of front-end web development.
Paper Structure (28 sections, 11 equations, 3 figures)

This paper contains 28 sections, 11 equations, 3 figures.

Figures (3)

  • Figure 1: View tree generated by membero applied to a cons list
  • Figure 2: View tree generated by imembero applied to an insertion list
  • Figure 3: Visual presentation of TodoMVC implementation