4th April 2008, 02:27 pm

I submitted a paper *Simply efficient functional reactivity* to ICFP 2008.

**Abstract:**

Functional reactive programming (FRP) has simple and powerful semantics, but has resisted efficient implementation. In particular, most past implementations have used demand-driven sampling, which accommodates FRP’s continuous time semantics and fits well with the nature of functional programming. Consequently, values are wastefully recomputed even when inputs don’t change, and reaction latency can be as high as the sampling period.

This paper presents a way to implement FRP that combines data- and demand-driven evaluation, in which values are recomputed only when necessary, and reactions are nearly instantaneous. The implementation is rooted in a new simple formulation of FRP and its semantics and so is easy to understand and reason about.

On the road to efficiency and simplicity, we’ll meet some old friends (monoids, functors, applicative functors, monads, morphisms, and improving values) and make some new friends (functional future values, reactive normal form, and concurrent “unambiguous choice”).

: http://conal.net/papers/simply-reactive "Paper: "Simply efficient functional reactivity""
: http://www.icfpconference.org/icfp2008 "ICFP 2008 conference page"
I submitted a paper ** to .
**Abstract:**
> Functional reactive programming (FRP) has simple and powerful semantics, but has resisted efficient implementation. In particular, most past implementations have used demand-driven sampling, which accommodates FRP's continuous ...

Tags:

applicative functor,

continuous,

discrete,

events,

FRP,

functional reactive programming,

functor,

future value,

icfp,

implementation,

joinMaybes,

monad,

monoid,

multi-threading,

normal form,

paper,

reactive behavior,

reactive value,

semantics,

time,

type class,

type class morphism,

type composition |

33 Comments
25th January 2008, 06:52 pm

25th January 2008, 03:00 pm

25th January 2008, 01:56 pm

I’ve gotten interested lately in revisiting functional reactive programming (FRP). I was never entirely satisfied with the semantics or implementation in my original Fran formulation or in its successors. Over the last year, I’ve enjoyed getting more interface and functionality from standard type classes, and I’ve realized that quite a lot of FRP could be both packaged and implemented by leveraging those classes. This post describes that packaging, and in particular shows how the `Monad`

interface makes some operations very easy to define. I suspect that monadic functional reactivity is a very powerful structuring tool with lovely applications.

At ICFP 07, I had a conversation with Mike Sperber about FRP and about his FRP-based Lula system for stage lighting. Mike used blocking threads in Lula, which I had never considered for FRP. While playing with the idea, I realized that I could give a very elegant and efficient solution to caching, unlike my previous FRP implementations, including the recent DataDriven library. From there, I stumbled on the idea of *reactive normal form* and separating out an aspect of reactivity into the notion of *future values*. A third new (to me) idea is to factor out continuity from reactivity, so that *reactive behaviors* arise by composing orthogonal notions of *reactive values* and non-reactive functions of continuous time.

Two previous posts presented *future values*, first describing interface and semantics and then a multi-threaded implementation. This post builds a simple foundation for FRP on top of future values, as part of a library Reactive.

Continue reading ‘Reactive values from the future’ »

: http://www.informatik.uni-bonn.de/~ralf/icfp07.html "International Conference on Functional Programming, 2007"
: http://www.deinprogramm.de/sperber/ "Home page: Mike Sperber"
: http://www-pu.informatik.uni-tuebingen.de/lula "The Lula system for lighting design and control"
: http://conal.net/blog/posts/future-values/ "Blog post: "Future values""
: http://conal.net/blog/posts/future-values-via-multi-threading/ "Blog post: "Future values via multi-threading""
: http://haskell.org/haskellwiki/DataDriven "Wiki page on the DataDriven library"
: http://conal.net/Fran "Fran -- functional reactive animation"
: http://haskell.org/haskellwiki/Reactive "Wiki page ...