[reactive] FRP, continuous time and concurrency
f.manners at gmail.com
Wed Jun 10 07:32:13 EDT 2009
So, it may be that we've made Num a => Behavior a an instance of Num in
which case this is valid code; I think the definition
a = liftA2 (+) b c
is more instructive. The point is that Behavior is an instance of
Applicative, so we can apply a time-varying function (such as (+) b) to a
time-varying argument (such as c) so that the answer is modified when either
the function or the argument is.
2009/6/10 Patai Gergely <patai_gergely at fastmail.fm>
> > Anyway, can you give any implementation of this example using the
> > reactive library?
> If b and c are signals (or behaviours as they are called in Reactive)
> carrying Num values of the same type, you can simply say a = b + c, and
> you're done. Signal a will be updated only when either b or c is
> updated. Note that this must be understood in the context of laziness,
> i.e. not a single sum is calculated until a sample of a is requested.
> http://www.fastmail.fm - One of many happy users:
> Reactive mailing list
> Reactive at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Reactive