Asynchronous Functional Reactive Programming for GUIs
📜 Abstract
Graphical user interfaces (GUIs) mediate many of our interactions with computers. Functional Reactive Programming (FRP) is a promising approach to GUI design, providing high-level, declarative, compositional abstractions to describe user interactions and time-dependent computations. We present Elm, a practical FRP language focused on easy creation of responsive GUIs. Elm has two major features: simple declarative support for Asynchronous FRP; and purely functional graphical layout. Asynchronous FRP allows the programmer to specify when the global ordering of event processing can be violated, and thus enables efficient concurrent execution of FRP programs; long-running computation can be executed asynchronously and not adversely affect the responsiveness of the user interface. Layout in Elm is achieved using a purely functional declarative framework that makes it simple to create and combine text, images, and video into rich multimedia displays. Together, Elm’s two major features simplify the complicated task of creating responsive and usable GUIs.
✨ Summary
Summary
The paper presents Elm, a functional reactive programming language for responsive web-based graphical user interfaces. Its central technical contribution is Asynchronous FRP: programmers can explicitly mark signal computations whose event ordering need not remain globally synchronized. This permits pipelined and concurrent execution while preserving event order within the portions of a signal graph where ordering matters. Elm also treats signals as discrete and push-based, propagating noChange values to avoid unnecessary recomputation and to preserve the correct behavior of stateful folds.
The authors formalize these ideas in the Featherweight Elm calculus, including a stratified type system that prohibits signals-of-signals, a two-stage evaluation model, and a translation of signal graphs to Concurrent ML. The full language adds purely functional graphical layout, interactive input and time signals, HTTP and JSON support, and an embedding of discrete Arrowized FRP through its Automaton library. An Elm-to-JavaScript compiler demonstrates that the approach can be used to build deployable browser applications, although the paper reports no direct performance evaluation.
Influence
The paper is an early foundational description of Elm’s FRP model and is cited by subsequent research on reactive programming and formally verified GUI frameworks; for example, A Graphical User Interface Framework for Formal Verification lists it as related prior work. (drops.dagstuhl.de) Elm’s later development moved away from the paper’s signal-oriented interface: the official Elm account states that Elm 0.17 replaced signals with subscriptions and emphasized The Elm Architecture. The official Elm guide also documents that this architecture inspired Redux, providing a concrete connection to later JavaScript application-architecture practice. (elm-lang.org) The paper’s publication metadata and citation record are confirmed by ACM, which lists the work as published June 16, 2013, in ACM SIGPLAN Notices and attributes it to Czaplicki and Chong. (doi.org)