Functional reactive programming

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Functional reactive programming (FRP) is a programming paradigm for reactive programming using the building blocks of functional programming. FRP has been used for programming GUIs, robotics, and music, aiming to simplify these problems by explicitly modeling time.

Formulations of FRP[edit]

FRP has taken many forms since its introduction in 1997.[1] One axis of diversity is discrete vs. continuous semantics. Another axis is how FRP systems can be changed dynamically.[2]

Discrete[edit]

Formulations such as Event-Driven FRP and Elm require that updates are discrete and event-driven.[3] These formulations have pushed for practical FRP, focusing on a semantics that have a simple API that can be implemented efficiently in a setting such as robotics or in a web-browser.[4]

In these formulations, it is common that the ideas of behaviors and events have are combined into signals that always have a current value, but change discretely.[5]

Continuous[edit]

The earliest formulation of FRP used a continuous semantics, aiming to abstract over many operational details that are not important to the meaning of a program.[6] The key properties of this formulation are:

  • Modeling values that vary over continuous time, called "behaviors" and later "signals".
  • Modeling "events" which have occurrences at finitely many points in time.
  • The system can be changed in response to events, generally termed "switching."
  • The separation of evaluation details such as sampling rate from the reactive model.

This semantic model of FRP in side-effect free languages is typically in terms of continuous functions, and typically over time.[7]

See also[edit]

References[edit]

  1. ^ Evan Czaplicki, Elm: Concurrent FRP for Functional GUIs, 2012 Harvard Thesis
  2. ^ Henrik Nilsson, Antony Courtney, and John Peterson, Functional Reactive Programming, Continued, Haskell Workshop '02
  3. ^ Walid Taha and Zhanyong Wan and Paul Hudak, Event-Driven FRP, PADL '02
  4. ^ Evan Czaplicki and Stephen Chong, Asynchronous Functional Reactive Programming for GUIs, PLDI 2013
  5. ^ Zhanyong Wan, Walid Taha, and Paul Hudak, Real-Time FRP, ICFP '01
  6. ^ Conal Elliott and Paul Hudak, "Functional Reactive Animation", ICFP 1997
  7. ^ Antony Courtney and Conal Elliott, Genuinely Functional User Interfaces, 2001 Haskell Workshop
  8. ^ http://www.taodyne.com/shop/dev/en/blog/271-animation-and-3d-the-web-is-doing-it-wrong

External links[edit]