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 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’ »