I don't completely understand how can you wrap your reactive definition into a particular implementation.<br><br>Let's take the IO legacy adapter for example, how could I use the applicative lifting (liftA2) with behaviours to implement things inside the IO monad? Can you give some code adapting the "a = liftA2 (+) b c" example to the console? Are threads and concurrency required to do so?<br>
<br>Alvaro.<br><br><div class="gmail_quote">2009/6/10 Freddie Manners <span dir="ltr"><<a href="mailto:f.manners@gmail.com">f.manners@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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<br><br>a = liftA2 (+) b c<br><br>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.<br>
<br>Freddie<br><br><div class="gmail_quote">2009/6/10 Patai Gergely <span dir="ltr"><<a href="mailto:patai_gergely@fastmail.fm" target="_blank">patai_gergely@fastmail.fm</a>></span><div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>> Anyway, can you give any implementation of this example using the<br>
> reactive library?<br>
</div>If b and c are signals (or behaviours as they are called in Reactive)<br>
carrying Num values of the same type, you can simply say a = b + c, and<br>
you're done. Signal a will be updated only when either b or c is<br>
updated. Note that this must be understood in the context of laziness,<br>
i.e. not a single sum is calculated until a sample of a is requested.<br>
<br>
Gergely<br>
<font color="#888888"><br>
--<br>
<a href="http://www.fastmail.fm" target="_blank">http://www.fastmail.fm</a> - One of many happy users:<br>
<a href="http://www.fastmail.fm/docs/quotes.html" target="_blank">http://www.fastmail.fm/docs/quotes.html</a><br>
</font><div><div></div><div><br>
_______________________________________________<br>
Reactive mailing list<br>
<a href="mailto:Reactive@haskell.org" target="_blank">Reactive@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
</div></div></blockquote></div></div></div><br>
<br>_______________________________________________<br>
Reactive mailing list<br>
<a href="mailto:Reactive@haskell.org">Reactive@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
<br></blockquote></div><br>