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@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@haskell.org
http://www.haskell.org/mailman/listinfo/reactive