Functional reactive programming with liveness guarantees

  • Authors:
  • Alan Jeffrey

  • Affiliations:
  • Alcatel-Lucent, Naperville, IL, USA

  • Venue:
  • Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

Functional Reactive Programming (FRP) is an approach to the development of reactive systems which provides a pure functional interface, but which may be implemented as an abstraction of an imperative event-driven layer. FRP systems typically provide a model of behaviours (total time-indexed values, implemented as pull systems) and event sources (partial time-indexed values, implemented as push systems). In this paper, we investigate a type system for event-driven FRP programs which provide liveness guarantees, that is every input event is guaranteed to generate an output event. We show that FRP can be implemented on top of a model of sets and relations, and that the isomorphism between event sources and behaviours corresponds to the isomorphism between relations and set-valued functions. We then implement sets and relations using a model of continuations using the usual double-negation CPS transform. The implementation of behaviours as pull systems based on futures, and of event sources as push systems based on the observer pattern, thus arises from first principles. We also discuss a Java implementation of the FRP model.