View on GitHub


Documenting everything about OCaml


Functional Reactive Programming

Functional Reactive Programming is a model for programming that tries to adapt state-heavy programming such as UIs or games to the functional programming world. For example, the normal mode of operation for asynchronous event-driven programming is to use callbacks everywhere. However, this requires mutating state, since the user’s code is not driving the program but is being ‘driven’ via events. This model is common in GUIs and in Javascript.

The FRP approach is to transform state mutation over time into ‘signals’, and to describe what happens with those signals. This approach can be used in GUI programming, web interfaces, and many other domains.

  • React: a library for functional reactive programming (FRP). It provides support to program with time varying values. Used by, among others, the Eliom web framework.
  • Note: Experimental successor to React. Avoids using weak references, which are not available in Javascript.
  • Incremental: An FRP library used by Jane Street.
  • Cumulus: Differential FRP based on React.