10th December 2008, 01:26 am
In a previous post, I presented a fundamental reason why classic FRP does not fit interactive behavior, which is that the semantic model captures only the influence of time and not other input.
I also gave a simple alternative, with a simple and general model for temporal and spatial transformation, in which input behavior is transformed inversely to the transformation of output behavior.
The semantic model I suggested is the same as used in “Arrow FRP”, from Fruit and Yampa.
I want, however, a more convenient and efficient way to package up that model, which is the subject of the post you are reading now.
Next, we took a close look at one awkward aspect of classic FRP for interactive behavior, namely the need to trim inputs, and how trimming relates to comonadic FRP.
The trim
function allows us to define multi-phase interactive behaviors correctly and efficiently, but its use is tedious and is easy to get wrong.
It thus fails to achieve what I want from functional programming in general and FRP in particular, which is to enable writing simple, natural descriptions, free of mechanical details.
The current post hides and automates the mechanics of trimming, so that the intent of an interactive behavior can be expressed directly and executed correctly and efficiently.
Continue reading ‘Functional interactive behavior’ »
In a previous post, I presented a fundamental reason why classic FRP does not fit interactive behavior, which is that the semantic model captures only the influence of time and...
10th December 2008, 01:00 am
This post takes a close look at one awkward aspect of classic (non-arrow) FRP for interactive behavior, namely the need to trim (or “age”) old input.
Failing to trim results in behavior that is incorrect and grossly inefficient.
Behavior trimming connects directly into the comonad interface mentioned in a few recent posts, and is what got me interested in comonads recently.
In absolute-time FRP, trimming has a purely operational significance.
Switching to relative time, trimming is recast as a semantically familiar operation, namely the generalized drop
function used in two recent posts.
Continue reading ‘Trimming inputs in functional reactive programming’ »
This post takes a close look at one awkward aspect of classic (non-arrow) FRP for interactive behavior, namely the need to trim (or “age”) old input. Failing to trim results...
9th December 2008, 10:45 pm
In functional reactive programming (FRP), the type we call “behaviors” model non-interactive behavior.
To see why, just look at the semantic model: t -> a
, for some notion t
of time.
One can argue as follows that this model applies to interactive behavior as well.
Behaviors interacting with inputs are functions of time and of inputs.
Those inputs are also functions of time, so behaviors are just functions of time.
I held this perspective at first, but came to see a lack of composability.
My original FRP formulations (Fran and its predecessors TBAG and ActiveVRML), as well as the much more recent library Reactive, can be and are used to describe interactive behavior.
For simple sorts of things, this use works out okay.
When applications get a bit richer, the interface and semantics strain.
If you’ve delved a bit, you’ll have run into the signs of strain, with coping mechanisms like start times, user arguments and explicit aging of inputs, as you avoid the dreaded space-time leaks.
Continue reading ‘Why classic FRP does not fit interactive behavior’ »
In functional reactive programming (FRP), the type we call “behaviors” model non-interactive behavior. To see why, just look at the semantic model: t -> a, for some notion t of...