-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | FRP through value streams and monadic splines.
--   
--   Varying is a FRP library aimed at providing a simple way to describe
--   values that change over a domain. It allows monadic, applicative and
--   arrow notation and has convenience functions for tweening.
@package varying
@version 0.7.0.3


-- | Varying values represent values that change over a given domain.
--   
--   A stream/signal takes some input know as the domain (e.g. time, place,
--   etc) and when sampled using <a>runVarT</a> - produces a value and a
--   new stream. This pattern is known as an automaton. <tt>varying</tt>
--   uses this pattern as its base type with the additon of a monadic
--   computation to create locally stateful signals that change over some
--   domain.
module Control.Varying.Core

-- | A stream parameterized with Identity that takes input of type
--   <tt>a</tt> and gives output of type <tt>b</tt>. This is the pure,
--   effect-free version of <a>VarT</a>.
type Var a b = VarT Identity a b

-- | A stream is a structure that contains a value that changes over some
--   input. It's a kind of <a>Mealy machine</a> (an automaton) with
--   effects. Using <a>runVarT</a> with an input value of type <tt>a</tt>
--   yields a "step", which is a value of type <tt>b</tt> and a new stream
--   for yielding the next value.
newtype VarT m a b

-- | Given an input value, return a computation that effectfully produces
--   an output value and a new stream.
VarT :: (a -> m (b, VarT m a b)) -> VarT m a b
[runVarT] :: VarT m a b -> a -> m (b, VarT m a b)

-- | Lift a constant value to a stream.
done :: (Applicative m, Monad m) => b -> VarT m a b

-- | Lift a pure computation to a stream. This is <a>arr</a> parameterized
--   over the <tt>a `VarT m` b</tt> arrow.
var :: Applicative m => (a -> b) -> VarT m a b

-- | Lift a function to an arrow.
arr :: Arrow a => forall b c. () => (b -> c) -> a b c

-- | Lift a monadic computation to a stream. This is <a>arrM</a>
--   parameterized over the <tt>a `VarT m` b</tt> arrow.
varM :: Monad m => (a -> m b) -> VarT m a b

-- | Create a stream from a state transformer.
mkState :: Monad m => (a -> s -> (b, s)) -> s -> VarT m a b

-- | Right-to-left composition
(<<<) :: Category k cat => cat b c -> cat a b -> cat a c
infixr 1 <<<

-- | Left-to-right composition
(>>>) :: Category k cat => cat a b -> cat b c -> cat a c
infixr 1 >>>

-- | Delays the given stream by one sample using the argument as the first
--   sample.
--   
--   <pre>
--   &gt;&gt;&gt; testVarOver (delay 0 id) [1,2,3]
--   0
--   1
--   2
--   </pre>
--   
--   This enables the programmer to create streams that depend on
--   themselves for values. For example:
--   
--   <pre>
--   &gt;&gt;&gt; let v = delay 0 v + 1 in testVarOver v [1,1,1]
--   1
--   2
--   3
--   </pre>
delay :: (Monad m, Applicative m) => b -> VarT m a b -> VarT m a b

-- | Accumulates input values using a folding function and yields that
--   accumulated value each sample. This is analogous to a stepwise foldl.
--   
--   <pre>
--   &gt;&gt;&gt; testVarOver (accumulate (++) []) $ words "hey there man"
--   "hey"
--   "heythere"
--   "heythereman"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; print $ foldl (++) [] $ words "hey there man"
--   "heythereman"
--   </pre>
accumulate :: (Monad m, Applicative m) => (c -> b -> c) -> c -> VarT m b c

-- | Run the stream over the input values, gathering the output values in a
--   list.
--   
--   <pre>
--   &gt;&gt;&gt; let Identity (outputs, _) = scanVar (accumulate (+) 0) [1,1,1,1]
--   
--   &gt;&gt;&gt; print outputs
--   [1,2,3,4]
--   </pre>
scanVar :: (Applicative m, Monad m) => VarT m a b -> [a] -> m ([b], VarT m a b)

-- | Iterate a stream over a list of input until all input is consumed,
--   then iterate the stream using one single input. Returns the resulting
--   output value and the new stream.
--   
--   <pre>
--   &gt;&gt;&gt; let Identity (outputs, _) = stepMany (accumulate (+) 0) [1,1,1] 1
--   
--   &gt;&gt;&gt; print outputs
--   4
--   </pre>
stepMany :: (Monad m, Functor m) => VarT m a b -> [a] -> a -> m (b, VarT m a b)

-- | Trace the sample value of a stream and pass it along as output. This
--   is very useful for debugging graphs of streams. The (v|vs|vf)trace
--   family of streams use <a>trace</a> under the hood, so the value is
--   only traced when evaluated.
--   
--   <pre>
--   &gt;&gt;&gt; let v = id &gt;&gt;&gt; vtrace
--   
--   &gt;&gt;&gt; testVarOver v [1,2,3]
--   1
--   1
--   2
--   2
--   3
--   3
--   </pre>
vtrace :: (Applicative a, Show b) => VarT a b b

-- | Trace the sample value of a stream with a prefix and pass the sample
--   along as output. This is very useful for debugging graphs of streams.
--   
--   <pre>
--   &gt;&gt;&gt; let v = id &gt;&gt;&gt; vstrace "test: "
--   
--   &gt;&gt;&gt; testVarOver v [1,2,3]
--   test: 1
--   1
--   test: 2
--   2
--   test: 3
--   3
--   </pre>
vstrace :: (Applicative a, Show b) => String -> VarT a b b

-- | Trace the sample value using a custom show-like function. This is
--   useful when you would like to debug a stream that uses values that
--   don't have show instances.
--   
--   <pre>
--   &gt;&gt;&gt; newtype NotShowableInt = NotShowableInt { unNotShowableInt :: Int }
--   
--   &gt;&gt;&gt; let v = id &gt;&gt;&gt; vftrace (("NotShowableInt: " ++) . show . unNotShowableInt)
--   
--   &gt;&gt;&gt; let as = map NotShowableInt [1,1,1]
--   
--   &gt;&gt;&gt; bs &lt;- fst &lt;$&gt; scanVar v as
--   
--   &gt;&gt;&gt; -- We need to do something to evaluate these output values...
--   
--   &gt;&gt;&gt; print $ sum $ map unNotShowableInt bs
--   NotShowableInt: 1
--   NotShowableInt: 1
--   NotShowableInt: 1
--   3
--   </pre>
vftrace :: Applicative a => (b -> String) -> VarT a b b

-- | Run a stream in IO over some input, printing the output each step.
--   This is the function we've been using throughout this documentation.
testVarOver :: (Applicative m, Monad m, MonadIO m, Show b) => VarT m a b -> [a] -> m ()
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Functor (Control.Varying.Core.VarT m b)
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => Control.Category.Category (Control.Varying.Core.VarT m)
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Varying.Core.VarT m a)
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => Control.Arrow.Arrow (Control.Varying.Core.VarT m)
instance (GHC.Base.Applicative m, GHC.Base.Monad m, GHC.Base.Monoid b) => GHC.Base.Monoid (Control.Varying.Core.VarT m a b)
instance (GHC.Base.Applicative m, GHC.Base.Monad m, GHC.Num.Num b) => GHC.Num.Num (Control.Varying.Core.VarT m a b)
instance (GHC.Base.Applicative m, GHC.Base.Monad m, GHC.Float.Floating b) => GHC.Float.Floating (Control.Varying.Core.VarT m a b)
instance (GHC.Base.Applicative m, GHC.Base.Monad m, GHC.Real.Fractional b) => GHC.Real.Fractional (Control.Varying.Core.VarT m a b)


-- | An event stream is simply a stream of <tt>Maybe a</tt>. This kind of
--   stream is considered to be only defined at those occurances of
--   <tt>Just a</tt>. Events describe things that happen at a specific
--   time, place or any collection of inputs.
--   
--   For example, you can think of the event stream <tt><a>VarT</a>
--   <a>IO</a> <a>Double</a> (<a>Event</a> ())</tt> as an occurrence of
--   <tt>()</tt> at a specific value of <a>Double</a>. It is possible that
--   this <a>Double</a> is time, or it could be the number of ice cream
--   sandwiches eaten by a particular cat.
--   
--   In <tt>varying</tt> we use event streams to dynamically update the
--   network while it is running. For more info on switching and sequencing
--   streams with events please check out <a>Spline</a>, which lets you
--   chain together sequences of values and events using a familiar
--   do-notation.
module Control.Varying.Event
type Event = Maybe

-- | A synonym for the <tt>Maybe</tt> constructor <tt>Just</tt>.
event :: a -> Event a

-- | A synonym for the <tt>Maybe</tt> constructor <tt>Nothing</tt>.
noevent :: Event a

-- | <pre>
--   <a>use</a> :: <a>Monad</a> m =&gt; b -&gt; <a>VarT</a> m a (<a>Event</a> x) -&gt; <a>VarT</a> m a (<a>Event</a> b)
--   </pre>
--   
--   Populates a varying Event with a value. This is meant to be used with
--   the various <tt>on...</tt> event triggers. For example, <tt>
--   <a>use</a> 1 <a>onTrue</a> </tt> produces values of <tt><a>Event</a>
--   1</tt> when the input value is <a>True</a>.
use :: (Functor f, Functor e) => a -> f (e b) -> f (e a)

-- | Triggers an <tt><a>Event</a> ()</tt> when the input value is
--   <a>True</a>.
--   
--   <pre>
--   <a>use</a> b <a>onTrue</a> :: <a>Monad</a> m =&gt; <a>VarT</a> m <a>Bool</a> (<a>Event</a> b)
--   </pre>
onTrue :: (Applicative m, Monad m) => VarT m Bool (Event ())

-- | Triggers an <tt><a>Event</a> a</tt> when the input is distinct from
--   the previous input.
--   
--   <pre>
--   <a>use</a> b <a>onUnique</a> :: (<a>Eq</a> x, <a>Monad</a> m) =&gt; <a>VarT</a> m x (<a>Event</a> b)
--   </pre>
onUnique :: (Applicative m, Monad m, Eq a) => VarT m a (Event a)

-- | Triggers an <tt><a>Event</a> a</tt> when the condition is met.
onWhen :: Applicative m => (a -> Bool) -> VarT m a (Event a)

-- | Like a left fold over all the stream's produced values.
foldStream :: Monad m => (a -> t -> a) -> a -> VarT m (Event t) a

-- | Produces the given value until the input events produce a value, then
--   produce that value until a new input event produces. This always holds
--   the last produced value, starting with the given value.
--   
--   <pre>
--   time <a>&gt;&gt;&gt;</a> <a>after</a> 3 <a>&gt;&gt;&gt;</a> <a>startingWith</a> 0
--   </pre>
startingWith :: (Applicative m, Monad m) => a -> VarT m (Event a) a

-- | Produces the given value until the input events produce a value, then
--   produce that value until a new input event produces. This always holds
--   the last produced value, starting with the given value.
--   
--   <pre>
--   time <a>&gt;&gt;&gt;</a> <a>after</a> 3 <a>&gt;&gt;&gt;</a> <a>startingWith</a> 0
--   </pre>
startWith :: (Applicative m, Monad m) => a -> VarT m (Event a) a

-- | Combine two <a>Event</a> streams. Produces an event only when both
--   streams proc at the same time.
bothE :: (Applicative m, Monad m) => (a -> b -> c) -> VarT m a (Event a) -> VarT m a (Event b) -> VarT m a (Event c)

-- | Combine two <a>Event</a> streams and produce an <a>Event</a> any time
--   either stream produces. In the case that both streams produce, this
--   produces the <a>Event</a> of the leftmost stream.
anyE :: (Applicative m, Monad m) => [VarT m a (Event b)] -> VarT m a (Event b)

-- | Inhibit all <a>Event</a>s that don't pass the predicate.
filterE :: (Applicative m, Monad m) => (b -> Bool) -> VarT m a (Event b) -> VarT m a (Event b)

-- | Stream through some number of successful <a>Event</a>s and then
--   inhibit forever.
takeE :: (Applicative m, Monad m) => Int -> VarT m a (Event b) -> VarT m a (Event b)

-- | Inhibit the first n occurences of an <a>Event</a>.
dropE :: (Applicative m, Monad m) => Int -> VarT m a (Event b) -> VarT m a (Event b)

-- | Produce the given event value once and then inhibit forever.
once :: (Applicative m, Monad m) => b -> VarT m a (Event b)

-- | Produces <a>Event</a>s with the initial value forever.
--   
--   <pre>
--   <a>always</a> e = <a>pure</a> (<a>Event</a> e)
--   </pre>
always :: (Applicative m, Monad m) => b -> VarT m a (Event b)

-- | Never produces any <a>Event</a> values.
--   
--   <pre>
--   <a>never</a> = <a>pure</a> <a>Nothing</a>
--   </pre>
never :: (Applicative m, Monad m) => VarT m b (Event c)

-- | Emits events before accumulating t of input dt. Note that as soon as
--   we have accumulated &gt;= t we stop emitting events and therefore an
--   event will never be emitted exactly at time == t.
before :: (Applicative m, Monad m, Num t, Ord t) => t -> VarT m t (Event t)

-- | Emits events after t input has been accumulated. Note that event
--   emission is not guaranteed to begin exactly at t, since it depends on
--   the input.
after :: (Applicative m, Monad m, Num t, Ord t) => t -> VarT m t (Event t)

-- | Produce <a>Event</a>s of a value stream <tt>v</tt> only when its input
--   value passes a predicate <tt>f</tt>. <tt>v</tt> maintains state while
--   cold.
onlyWhen :: (Applicative m, Monad m) => VarT m a b -> (a -> Bool) -> VarT m a (Event b)

-- | Produce events of a stream <tt>v</tt> only when an event stream
--   <tt>h</tt> produces an event. <tt>v</tt> and <tt>h</tt> maintain state
--   while cold.
onlyWhenE :: (Applicative m, Monad m) => VarT m a b -> VarT m a (Event c) -> VarT m a (Event b)


-- | Using splines we can easily create continuous streams from
--   discontinuous streams. A spline is a monadic layer on top of streams.
--   The idea is that we use a monad to splice together sequences of
--   streams that eventually end. This means taking two streams - an output
--   stream and an event stream - combining them into a temporarily
--   producing stream. Once that "stream pair" inhibits (stops producing),
--   the computation completes and returns a result value. That result
--   value is then used to determine the next spline in the sequence.
module Control.Varying.Spline

-- | A SplineT monad parameterized with Identity that takes input of type
--   <tt>a</tt>, output of type <tt>b</tt> and a result value of type
--   <tt>c</tt>.
type Spline a b c = SplineT a b Identity c

-- | <a>SplineT</a> shares all the types of <a>VarT</a> and adds a result
--   value. Its monad, input and output types (<tt>m</tt>, <tt>a</tt> and
--   <tt>b</tt>, respectively) represent the same parameters in
--   <a>VarT</a>. A spline adds a result type which represents the monadic
--   computation's result value.
--   
--   A spline either concludes in a result or it produces an output value
--   and another spline. This makes it a stream that eventually ends. We
--   can use this to set up our streams in a monadic fashion, where the end
--   result of one spline can be used to determine the next spline to run.
--   Using <a>outputStream</a> we can then fuse these piecewise continuous
--   (but otherwise discontinuous) streams into one continuous stream of
--   type <tt>VarT m a b</tt>. Alternatively you can simply poll the
--   network until it ends using <a>runSplineT</a>.
newtype SplineT a b m c
SplineT :: (a -> m (Either c (b, SplineT a b m c))) -> SplineT a b m c
[runSplineT] :: SplineT a b m c -> a -> m (Either c (b, SplineT a b m c))

-- | Permute a spline into one continuous stream. Since a spline is not
--   guaranteed to be defined over any domain (specifically on its edges),
--   this function takes a default value to use as the "last known value".
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let s :: SplineT () String IO ()  
--       s = do first &lt;- pure "accumulating until 3" `_untilEvent` (1 &gt;&gt;&gt; after 3)
--              secnd &lt;- pure "accumulating until 4" `_untilEvent` (1 &gt;&gt;&gt; after 4)
--              if first + secnd == 7
--                then step "done"
--                else step "something went wrong!"
--       v = outputStream s ""
--   in testVarOver v $ replicate 6 ()
--   
--   &gt;&gt;&gt; :}
--   "accumulating until 3"
--   "accumulating until 3"
--   "accumulating until 4"
--   "accumulating until 4"
--   "accumulating until 4"
--   "done"
--   </pre>
outputStream :: (Applicative m, Monad m) => SplineT a b m c -> b -> VarT m a b

-- | Create a spline from an event stream. Outputs <a>noevent</a> until the
--   event stream procs, at which point the spline concludes with the event
--   value.
untilProc :: (Applicative m, Monad m) => VarT m a (Event b) -> SplineT a (Event b) m b

-- | Create a spline from an event stream. Outputs <tt>b</tt> until the
--   event stream inhibits, at which point the spline concludes with
--   <tt>()</tt>.
whileProc :: (Applicative m, Monad m) => VarT m a (Event b) -> SplineT a b m ()

-- | Create a spline from a stream and an event stream. The spline uses the
--   stream's values as its own output values. The spline will run until
--   the event stream produces an event, at that point the last known
--   output value and the event value are tupled and returned as the
--   spline's result.
untilEvent :: (Applicative m, Monad m) => VarT m a b -> VarT m a (Event c) -> SplineT a b m (b, c)

-- | A variant of <a>untilEvent</a> that results in the last known output
--   value.
untilEvent_ :: (Applicative m, Monad m) => VarT m a b -> VarT m a (Event c) -> SplineT a b m b

-- | A variant of <a>untilEvent</a> that results in the event steam's event
--   value.
_untilEvent :: (Applicative m, Monad m) => VarT m a b -> VarT m a (Event c) -> SplineT a b m c

-- | A variant of <a>untilEvent</a> that discards both the output and event
--   values.
_untilEvent_ :: (Applicative m, Monad m) => VarT m a b -> VarT m a (Event c) -> SplineT a b m ()

-- | Run the spline over the input values, gathering the output values in a
--   list.
scanSpline :: (Applicative m, Monad m) => SplineT a b m c -> b -> [a] -> m [b]

-- | Produce the argument as an output value exactly once.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let s = do step "hi"
--              step "there"
--              step "friend"
--   in testVarOver (outputStream s "") [1,2,3,4]
--   
--   &gt;&gt;&gt; :}
--   "hi"
--   "there"
--   "friend"
--   "friend"
--   </pre>
step :: (Applicative m, Monad m) => b -> SplineT a b m ()

-- | Run two splines in parallel, combining their output. Return the result
--   of the spline that concludes first. If they conclude at the same time
--   the result is taken from the left spline.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let s1 = pure "route "   `_untilEvent` (1 &gt;&gt;&gt; after 2)
--       s2 = pure 666     `_untilEvent` (1 &gt;&gt;&gt; after 3)
--       s = do winner &lt;- race (\l r -&gt; l ++ show r) s1 s2
--              step $ show winner
--       v = outputStream s ""
--   in testVarOver v [(),(),()]
--   
--   &gt;&gt;&gt; :}
--   "route 666"
--   "Left 2"
--   "Left 2"
--   </pre>
race :: (Applicative m, Monad m) => (a -> b -> c) -> SplineT i a m d -> SplineT i b m e -> SplineT i c m (Either d e)

-- | Run many splines in parallel, combining their output with
--   <a>mappend</a>. Returns the result of the spline that concludes first.
--   If any conclude at the same time the leftmost result will be returned.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let ss = [ pure "hey "   `_untilEvent` (1 &gt;&gt;&gt; after 5)
--            , pure "there"  `_untilEvent` (1 &gt;&gt;&gt; after 3)
--            , pure "!"      `_untilEvent` (1 &gt;&gt;&gt; after 2) 
--            ]
--       s = do winner &lt;- raceAny ss
--              step $ show winner
--       v = outputStream s ""
--   in testVarOver v [(),()]
--   
--   &gt;&gt;&gt; :}
--   "hey there!"
--   "2"
--   </pre>
raceAny :: (Applicative m, Monad m, Monoid b) => [SplineT a b m c] -> SplineT a b m c

-- | Run two splines in parallel, combining their output. Once both splines
--   have concluded, return the results of each in a tuple.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let s1 = pure "hey "   `_untilEvent` (1 &gt;&gt;&gt; after 3)
--       s2 = pure "there!" `_untilEvent` (1 &gt;&gt;&gt; after 2)
--       s  = do tuple &lt;- merge (++) s1 s2
--               step $ show tuple
--       v  = outputStream s ""
--   in testVarOver v [(),(),()]
--   
--   &gt;&gt;&gt; :}
--   "hey there!"
--   "hey "
--   "(3,2)" 
--   </pre>
merge :: (Applicative m, Monad m) => (b -> b -> b) -> SplineT a b m c -> SplineT a b m d -> SplineT a b m (c, d)

-- | Capture the spline's last output value and tuple it with the spline's
--   result. This is helpful when you want to sample the last output value
--   in order to determine the next spline to sequence.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let s = do (Just x, "boom") &lt;- capture $ do step 0
--                                               step 1
--                                               step 2
--                                               return "boom"
--              -- x is 2
--              step $ x + 1
--   in testVarOver (outputStream s 666) [(),(),(),()]
--   
--   &gt;&gt;&gt; :}
--   0 
--   1
--   2
--   3
--   </pre>
capture :: (Applicative m, Monad m) => SplineT a b m c -> SplineT a b m (Event b, c)

-- | Map the output value of a spline.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   let s = mapOutput (pure show) $ step 1 &gt;&gt; step 2 &gt;&gt; step 3  
--   in testVarOver (outputStream s "") [(),(),()]    
--   
--   &gt;&gt;&gt; :}
--   "1"
--   "2"
--   "3"
--   </pre>
mapOutput :: (Applicative m, Monad m) => VarT m a (b -> t) -> SplineT a b m c -> SplineT a t m c

-- | Map the input value of a spline.
adjustInput :: (Applicative m, Monad m) => VarT m a (a -> r) -> SplineT r b m c -> SplineT a b m c
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Functor (Control.Varying.Spline.SplineT a b m)
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Monad (Control.Varying.Spline.SplineT a b m)
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Varying.Spline.SplineT a b m)
instance Control.Monad.Trans.Class.MonadTrans (Control.Varying.Spline.SplineT a b)
instance (GHC.Base.Applicative m, GHC.Base.Monad m, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Control.Varying.Spline.SplineT a b m)


-- | Tweening is a technique of generating intermediate samples of a type
--   <b>between</b> a start and end value. By sampling a running tween each
--   frame we get a smooth animation of a value over time.
--   
--   At first release <tt>varying</tt> is only capable of tweening
--   numerical values of type <tt>(Fractional t, Ord t) =&gt; t</tt> that
--   match the type of time you use. At some point it would be great to be
--   able to tween arbitrary types, and possibly tween one type into
--   another (pipe dreams).
module Control.Varying.Tween

-- | An easing function. The parameters are often named <tt>c</tt>,
--   <tt>t</tt> and <tt>b</tt>, where <tt>c</tt> is the total change in
--   value over the complete duration (endValue - startValue), <tt>t</tt>
--   is the current percentage (0 to 1) of the duration that has elapsed
--   and <tt>b</tt> is the start value.
--   
--   To make things simple only numerical values can be tweened and the
--   type of time deltas much match the tween's value type. This may change
--   in the future :)
type Easing t f = t -> f -> t -> t
type TweenT f t m = SplineT f t (StateT f m)
type Tween f t = TweenT f t Identity
runTweenT :: (Monad m, Num f) => TweenT f t m x -> f -> f -> m (Either x (t, TweenT f t m x), f)
scanTween :: (Functor m, Applicative m, Monad m, Num f) => TweenT f t m a -> t -> [f] -> m [t]

-- | Converts a tween into a continuous value stream. This is the tween
--   version of <a>outputStream</a>.
tweenStream :: (Applicative m, Monad m, Num f) => TweenT f t m x -> t -> VarT m f t

-- | Creates a spline that produces a value interpolated between a start
--   and end value using an easing equation (<a>Easing</a>) over a
--   duration. The resulting spline will take a time delta as input. Keep
--   in mind <a>tween</a> must be fed time deltas, not absolute time or
--   duration. This is mentioned because the author has made that mistake
--   more than once ;)
--   
--   <a>tween</a> concludes returning the latest output value.
tween :: (Applicative m, Monad m, Real f, Fractional f, Real t, Fractional t) => Easing t f -> t -> t -> f -> TweenT f t m t

-- | A version of <a>tween</a> that discards the result. It is simply
--   
--   <pre>
--   tween f a b c &gt;&gt; return ()
--   </pre>
tween_ :: (Applicative m, Monad m, Real t, Fractional t, Real f, Fractional f) => Easing t f -> t -> t -> f -> TweenT f t m ()

-- | Creates a tween that performs no interpolation over the duration.
constant :: (Applicative m, Monad m, Num t, Ord t) => a -> t -> TweenT t a m a

-- | A version of <a>tween</a> that maps its output using the given
--   constant function. <tt> withTween ease from to dur f = mapOutput (pure
--   f) $ tween ease from to dur </tt>
withTween :: (Applicative m, Monad m, Real t, Fractional t, Real a, Fractional a) => Easing t a -> t -> t -> a -> (t -> x) -> TweenT a x m t

-- | A version of <a>withTween</a> that discards its output.
withTween_ :: (Applicative m, Monad m, Real t, Fractional t, Real a, Fractional a) => Easing t a -> t -> t -> a -> (t -> x) -> TweenT a x m ()

-- | Ease linear.
linear :: (Floating t, Real f) => Easing t f

-- | Ease in circular.
easeInCirc :: (Floating t, Real f, Floating f) => Easing t f

-- | Ease out circular.
easeOutCirc :: (Floating t, Real f) => Easing t f

-- | Ease in exponential.
easeInExpo :: (Floating t, Real f) => Easing t f

-- | Ease out exponential.
easeOutExpo :: (Floating t, Real f) => Easing t f

-- | Ease in sinusoidal.
easeInSine :: (Floating t, Real f) => Easing t f

-- | Ease out sinusoidal.
easeOutSine :: (Floating t, Real f) => Easing t f

-- | Ease in and out sinusoidal.
easeInOutSine :: (Floating t, Real f) => Easing t f

-- | Ease in by some power.
easeInPow :: (Fractional t, Real f) => Int -> Easing t f

-- | Ease out by some power.
easeOutPow :: (Fractional t, Real f) => Int -> Easing t f

-- | Ease in cubic.
easeInCubic :: (Fractional t, Real f) => Easing t f

-- | Ease out cubic.
easeOutCubic :: (Fractional t, Real f) => Easing t f

-- | Ease in quadratic.
easeInQuad :: (Fractional t, Real f) => Easing t f

-- | Ease out quadratic.
easeOutQuad :: (Fractional t, Real f) => Easing t f


-- | <ul>
--   <li><i><tt>Core</tt></i> Automaton based value streams.</li>
--   <li><i><tt>Event</tt></i> Discontinuous value streams that occur only
--   sometimes.</li>
--   <li><i><tt>Spline</tt></i> Sequencing of value and event streams using
--   do-notation to form complex behavior.</li>
--   <li><i><tt>Tween</tt></i> Tween numerical values over time using
--   common easing functions. Great for animation.</li>
--   </ul>
module Control.Varying
