[Haskell-cafe] A question about causality in FRP

David Barbour dmbarbour at gmail.com
Fri Oct 14 05:43:40 CEST 2011

On Thu, Oct 13, 2011 at 7:54 AM, Alan Jeffrey <ajeffrey at bell-labs.com>wrote:

> A function (f : Beh A -> Beh B) is causal whenever it respects =t, i.e.
> (forall t . a =t b => f a =t f b).

Yes. Function outputs only depend on the past values of the input function.

Your solutions for double and weird are accurate. Double is lifting the
future at each instant into the present, which is obviously not causal. And
the `weird` function presumes you already have a obtained a complete view of
a behavior at each instant.

The `problem` such as it exists: you will be unable to causally construct
the argument to the `weird` function, except by modeling a nested/simulated
world (i.e. modeling one FRP system within another). This is not an
unrealistic endeavor, e.g. one might model the future position of a thrown
baseball in order to predict it. In this sense, `weird` is not weird.

If you want first-class behaviors or behavior transformers, those will need
a different abstraction than 'nested' behaviors. Nested != First Class.
You'd have special functions to lift a first-class behavior as an argument
(e.g. add a phantom type to prohibit non-causal observation), and to lower
it into the main system for sampling (e.g. ArrowApply).

`Deep` causality is not so much an issue, since it often makes perfect sense
to simulate one FRP behavior within another.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111013/5b012a59/attachment.htm>

More information about the Haskell-Cafe mailing list