paper

Functional Reactive Programming, Continued∗

  • Authors:

📜 Abstract

Functional Reactive Programming (FRP) extends a host programming language with a notion of time flow. Arrowized FRP (AFRP) is a version of FRP embedded in Haskell based on the arrow combinators. AFRP is a powerful synchronous dataflow programming language with hybrid modeling capabilities, combining advanced synchronous dataflow features with the higher-order lazy functional abstractions of Haskell. In this paper, we describe the AFRP programming style and our Haskell-based implementation. Of particular interest are the AFRP combinators that support dynamic collections and continuation-based switching. We show how these combinators can be used to express systems with an evolving structure that are difficult to model in more traditional dataflow languages.

✨ Summary

The paper presents Arrowized Functional Reactive Programming (AFRP), an approach that embeds reactive, time-dependent computation in Haskell using arrow combinators. It treats signal functions as first-class values while keeping signals themselves implicit, thereby providing a compositional model for causal synchronous dataflow and reducing the risk of time and space leaks associated with earlier FRP designs. The programming model supports both continuous- and discrete-time behavior, stateful primitives such as integration and event holding, event streams, feedback, and temporal switching.

Its central contribution is support for structurally dynamic reactive systems. Continuation-based switching allows stateful signal functions to be stopped, moved, resumed, stored, or discarded while preserving their internal state. Dynamic signal-function collections allow networks to add and remove components without resetting unrelated components. The paper demonstrates these mechanisms through a traffic-surveillance example in which vehicle trackers and pairwise tailgating detectors are created, removed, and rearranged as cars enter, leave, or change order. It also introduces the experimental embedSynch primitive, which gives an embedded subsystem an independently controllable time frame and sampling fidelity, supporting multi-rate execution and simulation speed control.

The implementation represents signal functions as state-transition functions that return both an output sample and a continuation. This representation makes internal state explicit and enables dynamic switching. Additional representations classify functions as general, pointwise, or constant, allowing optimizations such as avoiding redundant polling and simplifying dataflow compositions through algebraic identities. The authors identify limitations in numerical simulation, performance guarantees, and time transformation as areas for future work. (antonycourtney.com)

The work helped establish the arrowized FRP design that later became associated with Yampa. Subsequent Yampa-related material lists this paper as an early foundational contribution, and later work describes Yampa as using the continuation-based signal-function representation introduced in this line of research. The approach was subsequently applied to robotics, graphical user interfaces, games, and hybrid-system programming; later research also built on its implementation techniques to investigate dynamic optimization and improved scalability. (yampa-book.readthedocs.io)