Personal tools


From HaskellWiki

Revision as of 20:11, 21 October 2008 by Conal (Talk | contribs)

Jump to: navigation, search


Note: This page replaces old-reactive. The new reactive is not quite ready for easy use yet, but it's getting there.

Reactive is a simple foundation for programming reactive systems functionally. Like Fran/FRP, Reactive has a notions of (reactive) behaviors and events. Some unusual features:

  • Much of the original interface is replaced by instances of standard type classes. In most cases, the denotational semantics of these instances is simple and inevitable, following from the principle of type class morphisms.
  • The original idea of reactive behaviors is composed out of two simple notions:
    • Reactive values are temporally discrete and reactive. They have a purely data representation, and so cache for free.
    • Time functions are temporally continuous and non-reactive.
  • Reactive provides and builds on functional futures, which are time/value pairs with several handy type class instances. Futures allow one to conveniently compute with values before they can be known, with a simple, purely functional semantics (no IO). Futures are polymorphic over both values and time, requiring only that time is ordered.
  • A particularly useful type of time, based on Warren Burton's improving values, reveals partial information in the form of lower bounds and minima, before the times can be known precisely. (Semantically non-flat.)
  • Improving values are implemented on top of a semantically simple unambiguous choice operator, unamb. Although unamb is built on Concurrent Haskell threads, the scheduler nondeterminism does not leak through (assuming the argument-compatibility precondition holds).
  • Reactive manages (I hope) to get the efficiency of data-driven computation with a (sort-of) demand-driven architecture. For that reason, Reactive is garbage-collector-friendly. (GC favors demand-driven computation.)

The inspiration for Reactive was Mike Sperber's Lula implementation of FRP. Mike used blocking threads, which I had never considered for FRP before a conversation with him at ICFP 2007. While playing with the idea, I realized that I could give a very elegant and efficient solution to caching.

Besides this wiki page, here are more ways to find out about Reactive:

Please leave comments at the Talk page.