Real-Time FRP


Zhanyong Wan, Walid Taha, Paul Hudak


Functional reactive programming (FRP) is a declarative programming paradigm where the basic notions are continuous, time-varying behaviors and discrete, event-based reactivity.  FRP has been used successfully in many reactive programming domains such as animation, robotics, and graphical user interfaces.  The success of FRP in these domains encourages us to consider its use in real-time applications, where it is crucial that the cost of running a program be bounded and known before run-time.  But previous work on the semantics and implementation of FRP was not explicitly concerned about the issues of cost.  In fact, the resource consumption of FRP programs in the current implementation is often hard to predict.

As a first step towards addressing these concerns, this paper presents Real-Time FRP (RT-FRP), a statically-typed language where the time and space cost of each execution step for a given program is statically bounded.  To take advantage of existing work on languages with bounded resources, we split RT-FRP into two parts: a reactive part that captures the essential ingredients of FRP programs, and a base language part that can be instantiated to any generic programming language that has been shown to be terminating and resource-bounded.  This allows us to focus on the issues specific to RT-FRP, namely, two forms of recursion.  After presenting the operational explanation of what can go wrong due to the presence of recursion, we show how the typed version of the language is terminating and resource-bounded.

Most of our existing FRP programs are expressible directly in RT-FRP.  The rest are expressible via a simple mechanism that integrates RT-FRP with the base language.


  author = 	 "Zhanyong Wan and Walid Taha and Paul Hudak",
  title = 	 "Real-Time {FRP}",
  booktitle =	 "International Conference on Functional Programming
  year = 	 "2001",