PLDI

Functional Reactive Programming (FRP)

4 thoughts
last posted Dec. 22, 2013, 1:10 a.m.
0
get stream as: markdown or atom
0

Function Reactive Programming (FRP) is a style of functional programming where an application is a function from inputs to outputs.

0

One can imagine the output of an application as a function of its initial state plus a stream of events to produce an output. As new events occur, the function can be re-run to update the application output.

0

If an application has internal state of some sort, it can "fold" over the event stream with a subroutine taking the current internal state plus a new event to yield a new internal state.

0

FRP is a very conceptual model for writing interactive applications but it has some challenges in efficient implementation - the memory requirements of keeping a complete or even partial history of all inputs are too great.

In lazy languages like Haskell this history might be kept accidentally because unevaluated expressions can keep references to older states.

So now FRP implementations don't give you the whole list. Instead you provide a function that the runtime applies to new events (and optionally a past and present state).