[reactive] Bounce
Conal Elliott
conal at conal.net
Fri Nov 21 09:48:09 EST 2008
For that matter, you can also say, thanks to Num overloading:
positionB :: Double -> Behavior Double -> Behavior Double -> Behavior Double
positionB x0 v t = pure x0 + v * t
Sadly, similar convenience does not come for free with non-methods, such as
most of the FieldTrip API. For non-methods, in the past (with Fran), I've
written parallel sets of modules with behavior-lifted functionality. It's
tedious to set up but convenient to use. Perhaps a tool could automate the
job.
By the way, a nice feature of Yampa is that it avoids this lifting business
altogether, via desugaring for the arrow notation.
- Conal
On Fri, Nov 21, 2008 at 12:14 AM, Thomas Davie <tom.davie at gmail.com> wrote:
>
>> positionB :: Double -> Behavior Double -> Behavior Double -> Behavior
>> Double
>> positionB x0 v t = (x0 +) <$> liftA2 (*) v t
>>
>
> On an unrelated note, I created a package called InfixApplicative, because
> I found that exactly this kind of expression looked ugly in my code. If you
> import it, you can define this instead:
>
> positionB x0 v t = (x0 +) <$> (v <^(*)^> t)
>
> Hope that helps
>
> Bob
>
> _______________________________________________
> Reactive mailing list
> Reactive at haskell.org
> http://www.haskell.org/mailman/listinfo/reactive
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/reactive/attachments/20081121/2da763ae/attachment.htm
More information about the Reactive
mailing list