varying 0.2.0.0 → 0.3.0.0
raw patch · 3 files changed
+13/−5 lines, 3 files
Files
- src/Control/Varying/Spline.hs +10/−2
- src/Control/Varying/Tween.hs +2/−2
- varying.cabal +1/−1
src/Control/Varying/Spline.hs view
@@ -29,6 +29,7 @@ runSplineT, evalSplineT, execSplineT,+ output, -- * Special operations. untilEvent, race,@@ -249,8 +250,15 @@ ec' = (mb',) <$> ec return (Step fb ec', runSplineT $ capture' mb' v'') +-- | Produce the argument as an output value exactly once, then return ().+output :: (Applicative m, Monad m, Monoid (f b), Applicative f)+ => b -> SplineT f a b m ()+output b = SplineT $ Var $ \_ ->+ return (Step (pure b) NoEvent, pure $ Step (pure b) $ Event ())+ -- | Map the output value of a spline. mapOutput :: (Functor f, Monoid (f t), Applicative m, Monad m)- => Var m a (f b -> f t) -> SplineT f a b m c -> SplineT f a t m c+ => Var m a (b -> t) -> SplineT f a b m c -> SplineT f a t m c mapOutput _ (SplineTConst c) = SplineTConst c-mapOutput vf (SplineT vx) = SplineT $ toIter <$> vf <*> vx+mapOutput vf (SplineT vx) = SplineT $ toIter <$> vg <*> vx+ where vg = (<$>) <$> vf
src/Control/Varying/Tween.hs view
@@ -151,7 +151,7 @@ where g t = let c = end - start b = start x = f c t b- in if t <= 1.0 then Event x else NoEvent+ in if t >= 1.0 then NoEvent else Event x -- | Creates a tween that performs no interpolation over the duration. constant :: (Applicative m, Monad m, Num t, Ord t)@@ -161,7 +161,7 @@ -- | Varies 0.0 to 1.0 linearly for duration `t` and 1.0 after `t`. timeAsPercentageOf :: (Applicative m, Monad m, Ord t, Num t, Fractional t) => t -> Var m t t-timeAsPercentageOf t = (\t' -> min 1 (t' / t)) <$> accumulate (+) 0+timeAsPercentageOf t = ((\t' -> min 1 (t' / t)) <$> accumulate (+) 0) -------------------------------------------------------------------------------- -- $writing
varying.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.2.0.0+version: 0.3.0.0 -- A short (one-line) description of the package. synopsis: FRP through value streams and monadic splines.