Shouldn&#39;t Reactive also have VectorSpace instances for Behaviors of VectorSpace elements? So that the code becomes<div><div><br><div>&gt; positionB x0 v t = pure x0 &nbsp;^+^ &nbsp;v &nbsp;^* &nbsp;t</div><div><br></div><div>Maybe it already has, in that case, sorry for the spam ;)<br>
</div><div><br></div><div><div class="gmail_quote">On Fri, Nov 21, 2008 at 7:00 PM, Greg Fitzgerald <span dir="ltr">&lt;<a href="mailto:garious@gmail.com">garious@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">&gt;&gt;&gt; positionB :: Double -&gt; Behavior Double -&gt; Behavior Double -&gt; Behavior Double<br>
&gt;&gt;&gt; positionB x0 v t = (x0 +) &lt;$&gt; liftA2 (*) v t<br>
</div><div class="Ih2E3d">&gt; positionB x0 v t = pure x0 + v * t<br>
<br>
</div>That&#39;s very convenient. &nbsp;I&#39;m showing this stuff off to visual<br>
designers, so tricks like this have great Sales appeal. :)<br>
<br>
If others are trying this out, the Num instance is implemented in<br>
FRP.Reactive.Num.<br>
<font color="#888888"><br>
-Greg<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
On Fri, Nov 21, 2008 at 6:48 AM, Conal Elliott &lt;<a href="mailto:conal@conal.net">conal@conal.net</a>&gt; wrote:<br>
&gt; For that matter, you can also say, thanks to Num overloading:<br>
&gt;<br>
&gt; positionB :: Double -&gt; Behavior Double -&gt; Behavior Double -&gt; Behavior Double<br>
&gt; positionB x0 v t = pure x0 + v * t<br>
&gt;<br>
&gt; Sadly, similar convenience does not come for free with non-methods, such as<br>
&gt; most of the FieldTrip API. &nbsp;For non-methods, in the past (with Fran), I&#39;ve<br>
&gt; written parallel sets of modules with behavior-lifted functionality. &nbsp;It&#39;s<br>
&gt; tedious to set up but convenient to use. &nbsp;Perhaps a tool could automate the<br>
&gt; job.<br>
&gt;<br>
&gt; By the way, a nice feature of Yampa is that it avoids this lifting business<br>
&gt; altogether, via desugaring for the arrow notation.<br>
&gt;<br>
&gt; &nbsp; &nbsp;- Conal<br>
&gt;<br>
&gt; On Fri, Nov 21, 2008 at 12:14 AM, Thomas Davie &lt;<a href="mailto:tom.davie@gmail.com">tom.davie@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; positionB :: Double -&gt; Behavior Double -&gt; Behavior Double -&gt; Behavior<br>
&gt;&gt;&gt; Double<br>
&gt;&gt;&gt; positionB x0 v t = (x0 +) &lt;$&gt; liftA2 (*) v t<br>
&gt;&gt;<br>
&gt;&gt; On an unrelated note, I created a package called InfixApplicative, because<br>
&gt;&gt; I found that exactly this kind of expression looked ugly in my code. &nbsp;If you<br>
&gt;&gt; import it, you can define this instead:<br>
&gt;&gt;<br>
&gt;&gt; positionB x0 v t = (x0 +) &lt;$&gt; (v &lt;^(*)^&gt; t)<br>
&gt;&gt;<br>
&gt;&gt; Hope that helps<br>
&gt;&gt;<br>
&gt;&gt; Bob<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Reactive mailing list<br>
&gt;&gt; <a href="mailto:Reactive@haskell.org">Reactive@haskell.org</a><br>
&gt;&gt; <a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
&gt;<br>
&gt;<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>
</div></div></blockquote></div><br></div></div></div>