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


-- | Functional Reactive Programming with type-level clocks
--   
--   Rhine is a library for synchronous and asynchronous Functional
--   Reactive Programming (FRP). It separates the aspects of clocking,
--   scheduling and resampling from each other, and ensures clock-safety on
--   the type level. Signal processing units can be annotated by clocks,
--   which hold the information when data will be input, processed and
--   output. Different components of the signal network will become active
--   at different times, or work at different rates. To schedule the
--   components and allow them to communicate, several standard scheduling
--   and resampling solutions are implemented. Own schedules and resampling
--   buffers can be implemented in a reusable fashion. A (synchronous)
--   program outputting "Hello World!" every tenth of a second looks like
--   this: <tt>flow $ arrMSync_ (putStrLn "Hello World!") </tt><tt>
--   (waitClock :: Millisecond 100)</tt>
@package rhine
@version 0.4.0.1

module Control.Monad.Schedule

-- | A functor implementing a syntactical "waiting" action.
--   
--   <ul>
--   <li><tt>diff</tt> represents the duration to wait.</li>
--   <li><tt>a</tt> is the encapsulated value.</li>
--   </ul>
data Wait diff a
Wait :: diff -> a -> Wait diff a

-- | Values in <tt>ScheduleT diff m</tt> are delayed computations with side
--   effects in <tt>m</tt>. Delays can occur between any two side effects,
--   with lengths specified by a <tt>diff</tt> value. These delays don't
--   have any semantics, it can be given to them with <a>runScheduleT</a>.
type ScheduleT diff = FreeT (Wait diff)

-- | The side effect that waits for a specified amount.
wait :: Monad m => diff -> ScheduleT diff m ()

-- | Supply a semantic meaning to <a>Wait</a>. For every occurrence of
--   <tt>Wait diff</tt> in the <tt>ScheduleT diff m a</tt> value, a waiting
--   action is executed, depending on <tt>diff</tt>.
runScheduleT :: Monad m => (diff -> m ()) -> ScheduleT diff m a -> m a

-- | Run a <a>ScheduleT</a> value in a <a>MonadIO</a>, interpreting the
--   times as milliseconds.
runScheduleIO :: (MonadIO m, Integral n) => ScheduleT n m a -> m a

-- | Runs two values in <a>ScheduleT</a> concurrently and returns the first
--   one that yields a value (defaulting to the first argument), and a
--   continuation for the other value.
race :: (Ord diff, Num diff, Monad m) => ScheduleT diff m a -> ScheduleT diff m b -> ScheduleT diff m (Either (a, ScheduleT diff m b) (ScheduleT diff m a, b))

-- | Runs both schedules concurrently and returns their results at the end.
async :: (Ord diff, Num diff, Monad m) => ScheduleT diff m a -> ScheduleT diff m b -> ScheduleT diff m (a, b)
instance GHC.Base.Functor (Control.Monad.Schedule.Wait diff)

module FRP.Rhine.TimeDomain

-- | Any <a>Num</a> can be wrapped to form a <a>TimeDomain</a>.
newtype NumTimeDomain a
NumTimeDomain :: a -> NumTimeDomain a
[fromNumTimeDomain] :: NumTimeDomain a -> a

-- | A time domain is an affine space representing a notion of time, such
--   as real time, simulated time, steps, or a completely different notion.
class TimeDomain td where {
    type family Diff td;
}
diffTime :: TimeDomain td => td -> td -> Diff td

-- | This is the simplest representation of UTC. It consists of the day
--   number, and a time offset from midnight. Note that if a day has a leap
--   second added to it, it will have 86401 seconds.
data UTCTime
instance GHC.Num.Num a => GHC.Num.Num (FRP.Rhine.TimeDomain.NumTimeDomain a)
instance GHC.Num.Num a => FRP.Rhine.TimeDomain.TimeDomain (FRP.Rhine.TimeDomain.NumTimeDomain a)
instance FRP.Rhine.TimeDomain.TimeDomain Data.Time.Clock.Internal.UTCTime.UTCTime
instance FRP.Rhine.TimeDomain.TimeDomain GHC.Types.Double
instance FRP.Rhine.TimeDomain.TimeDomain GHC.Types.Float
instance FRP.Rhine.TimeDomain.TimeDomain GHC.Integer.Type.Integer
instance FRP.Rhine.TimeDomain.TimeDomain ()

module FRP.Rhine.Clock

-- | A clock creates a stream of time stamps, possibly together with side
--   effects in a monad <tt>m</tt> that cause the environment to wait until
--   the specified time is reached.
--   
--   Since we want to leverage Haskell's type system to annotate signal
--   functions by their clocks, each clock must be an own type,
--   <tt>cl</tt>. Different values of the same clock type should tick at
--   the same speed, and only differ in implementation details. Often,
--   clocks are singletons.
class TimeDomain (TimeDomainOf cl) => Clock m cl where {
    type family TimeDomainOf cl;
    type family Tag cl;
}

-- | The method that produces to a clock value a running clock, i.e. an
--   effectful stream of tagged time stamps together with an initialisation
--   time.
startClock :: Clock m cl => cl -> m (MSF m () (TimeDomainOf cl, Tag cl), TimeDomainOf cl)

-- | An annotated, rich time stamp.
data TimeInfo cl
TimeInfo :: Diff (TimeDomainOf cl) -> Diff (TimeDomainOf cl) -> TimeDomainOf cl -> Tag cl -> TimeInfo cl

-- | Time passed since the last tick
[sinceTick] :: TimeInfo cl -> Diff (TimeDomainOf cl)

-- | Time passed since the initialisation of the clock
[sinceStart] :: TimeInfo cl -> Diff (TimeDomainOf cl)

-- | The absolute time of the current tick
[absolute] :: TimeInfo cl -> TimeDomainOf cl

-- | The tag annotation of the current tick
[tag] :: TimeInfo cl -> Tag cl

-- | A utility that changes the tag of a <a>TimeInfo</a>.
retag :: (TimeDomainOf cl1 ~ TimeDomainOf cl2) => (Tag cl1 -> Tag cl2) -> TimeInfo cl1 -> TimeInfo cl2

-- | Given a clock value and an initial time, generate a stream of time
--   stamps.
genTimeInfo :: (Monad m, Clock m cl) => cl -> TimeDomainOf cl -> MSF m (TimeDomainOf cl, Tag cl) (TimeInfo cl)

-- | Applying a morphism of time domains yields a new clock.
data RescaledClock cl td
RescaledClock :: cl -> TimeDomainOf cl -> td -> RescaledClock cl td
[unscaledClock] :: RescaledClock cl td -> cl
[rescale] :: RescaledClock cl td -> TimeDomainOf cl -> td

-- | Instead of a mere function as morphism of time domains, we can
--   transform one time domain into the other with a monadic stream
--   function.
data RescaledClockS m cl td tag
RescaledClockS :: cl -> TimeDomainOf cl -> m (MSF m (TimeDomainOf cl, Tag cl) (td, tag), td) -> RescaledClockS m cl td tag

-- | The clock before the rescaling
[unscaledClockS] :: RescaledClockS m cl td tag -> cl

-- | The rescaling stream function, and rescaled initial time, depending on
--   the initial time before rescaling
[rescaleS] :: RescaledClockS m cl td tag -> TimeDomainOf cl -> m (MSF m (TimeDomainOf cl, Tag cl) (td, tag), td)

-- | Applying a monad morphism yields a new clock.
data HoistClock m1 m2 cl
HoistClock :: cl -> forall a. m1 a -> m2 a -> HoistClock m1 m2 cl
[hoistedClock] :: HoistClock m1 m2 cl -> cl
[monadMorphism] :: HoistClock m1 m2 cl -> forall a. m1 a -> m2 a
type LiftClock m t cl = HoistClock m (t m) cl
liftClock :: (Monad m, MonadTrans t) => cl -> LiftClock m t cl
instance (GHC.Base.Monad m1, GHC.Base.Monad m2, FRP.Rhine.Clock.Clock m1 cl) => FRP.Rhine.Clock.Clock m2 (FRP.Rhine.Clock.HoistClock m1 m2 cl)
instance (GHC.Base.Monad m, FRP.Rhine.TimeDomain.TimeDomain td, FRP.Rhine.Clock.Clock m cl) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Clock.RescaledClockS m cl td tag)
instance (GHC.Base.Monad m, FRP.Rhine.TimeDomain.TimeDomain td, FRP.Rhine.Clock.Clock m cl) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Clock.RescaledClock cl td)

module FRP.Rhine.SyncSF

-- | A (synchronous) monadic stream function with the additional side
--   effect of being time-aware, that is, reading the current
--   <a>TimeInfo</a> of the clock <tt>cl</tt>.
type SyncSF m cl a b = MSF (ReaderT (TimeInfo cl) m) a b

-- | A synchronous signal is a <a>SyncSF</a> with no input required. It
--   produces its output on its own.
type SyncSignal m cl a = SyncSF m cl () a

-- | A (side-effectful) behaviour is a time-aware stream that doesn't
--   depend on a particular clock. <tt>td</tt> denotes the
--   <a>TimeDomain</a>.
type Behaviour m td a = forall cl. td ~ TimeDomainOf cl => SyncSignal m cl a

-- | Compatibility to U.S. american spelling.
type Behavior m td a = Behaviour m td a

-- | A (side-effectful) behaviour function is a time-aware synchronous
--   stream function that doesn't depend on a particular clock. <tt>td</tt>
--   denotes the <a>TimeDomain</a>.
type BehaviourF m td a b = forall cl. td ~ TimeDomainOf cl => SyncSF m cl a b

-- | Compatibility to U.S. american spelling.
type BehaviorF m td a b = BehaviourF m td a b

-- | Hoist a <a>SyncSF</a> along a monad morphism.
hoistSyncSF :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> SyncSF m1 cl a b -> SyncSF m2 (HoistClock m1 m2 cl) a b

-- | A monadic stream function without dependency on time is a
--   <a>SyncSF</a> for any clock.
timeless :: Monad m => MSF m a b -> SyncSF m cl a b

-- | Utility to lift Kleisli arrows directly to <a>SyncSF</a>s.
arrMSync :: Monad m => (a -> m b) -> SyncSF m cl a b

-- | Version without input.
arrMSync_ :: Monad m => m b -> SyncSF m cl a b

-- | Read the environment variable, i.e. the <a>TimeInfo</a>.
timeInfo :: Monad m => SyncSF m cl a (TimeInfo cl)

-- | Utility to apply functions to the current <a>TimeInfo</a>, such as
--   record selectors: <tt> printAbsoluteTime :: SyncSF IO cl () ()
--   printAbsoluteTime = timeInfoOf absolute &gt;&gt;&gt; arrMSync print
--   </tt>
timeInfoOf :: Monad m => (TimeInfo cl -> b) -> SyncSF m cl a b

-- | Alias for <a>&gt;&gt;&gt;</a> (sequential composition) with higher
--   operator precedence, designed to work with the other operators, e.g.:
--   
--   <pre>
--   syncsf1 &gt;-&gt; syncsf2 @@ clA **@ sched @** syncsf3 &gt;-&gt; syncsf4 @@ clB
--   </pre>
--   
--   The type signature specialises e.g. to
--   
--   <pre>
--   (&gt;-&gt;) :: Monad m =&gt; SyncSF m cl a b -&gt; SyncSF m cl b c -&gt; SyncSF m cl a c
--   </pre>
(>->) :: Category cat => cat a b -> cat b c -> cat a c
infixr 6 >->

-- | Alias for <a>&lt;&lt;&lt;</a>.
(<-<) :: Category cat => cat b c -> cat a b -> cat a c
infixl 6 <-<

-- | Output a constant value. Specialises e.g. to this type signature:
--   
--   <pre>
--   arr_ :: Monad m =&gt; b -&gt; SyncSF m cl a b
--   </pre>
arr_ :: Arrow a => b -> a c b

-- | The identity synchronous stream function.
syncId :: Monad m => SyncSF m cl a a

-- | The output of <tt>integralFrom v0</tt> is the numerical Euler integral
--   of the input, with initial offset <tt>v0</tt>.
integralFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => v -> BehaviorF m td v v

-- | Euler integration, with zero initial offset.
integral :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => BehaviorF m td v v

-- | The output of <tt>derivativeFrom v0</tt> is the numerical derivative
--   of the input, with a Newton difference quotient. The input is
--   initialised with <tt>v0</tt>.
derivativeFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => v -> BehaviorF m td v v

-- | Numerical derivative with input initialised to zero.
derivative :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => BehaviorF m td v v

-- | A weighted moving average signal function. The output is the average
--   of the first input, weighted by the second input (which is assumed to
--   be always between 0 and 1). The weight is applied to the average of
--   the last tick, so a weight of 1 simply repeats the past value
--   unchanged, whereas a weight of 0 outputs the current value.
weightedAverageFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => v -> BehaviorF m td (v, Groundfield v) v

-- | An exponential moving average, or low pass. It will average out, or
--   filter, all features below a given time scale.
averageFrom :: (Monad m, VectorSpace v, Floating (Groundfield v), Groundfield v ~ Diff td) => v -> Diff td -> BehaviorF m td v v

-- | An average, or low pass, initialised to zero.
average :: (Monad m, VectorSpace v, Floating (Groundfield v), Groundfield v ~ Diff td) => Diff td -> BehaviourF m td v v

-- | A linearised version of <a>averageFrom</a>. It is more efficient, but
--   only accurate if the supplied time scale is much bigger than the
--   average time difference between two ticks.
averageLinFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => v -> Diff td -> BehaviourF m td v v

-- | Linearised version of <a>average</a>.
averageLin :: (Monad m, VectorSpace v, Groundfield v ~ Diff td) => Diff td -> BehaviourF m td v v

module FRP.Rhine.Schedule

-- | A schedule implements a combination of two clocks. It outputs a time
--   stamp and an <a>Either</a> value, which specifies which of the two
--   subclocks has ticked.
data Schedule m cl1 cl2
Schedule :: cl1 -> cl2 -> m (MSF m () (TimeDomainOf cl1, Either (Tag cl1) (Tag cl2)), TimeDomainOf cl1) -> Schedule m cl1 cl2
[startSchedule] :: Schedule m cl1 cl2 -> cl1 -> cl2 -> m (MSF m () (TimeDomainOf cl1, Either (Tag cl1) (Tag cl2)), TimeDomainOf cl1)

-- | Lift a schedule along a monad morphism.
hoistSchedule :: (Monad m1, Monad m2) => (forall a. m1 a -> m2 a) -> Schedule m1 cl1 cl2 -> Schedule m2 cl1 cl2

-- | Swaps the clocks for a given schedule.
flipSchedule :: Monad m => Schedule m cl1 cl2 -> Schedule m cl2 cl1

-- | Two clocks can be combined with a schedule as a clock for an
--   asynchronous sequential composition of signal functions.
data SequentialClock m cl1 cl2
SequentialClock :: cl1 -> cl2 -> Schedule m cl1 cl2 -> SequentialClock m cl1 cl2
[sequentialCl1] :: SequentialClock m cl1 cl2 -> cl1
[sequentialCl2] :: SequentialClock m cl1 cl2 -> cl2
[sequentialSchedule] :: SequentialClock m cl1 cl2 -> Schedule m cl1 cl2

-- | Two clocks can be combined with a schedule as a clock for an
--   asynchronous parallel composition of signal functions.
data ParallelClock m cl1 cl2
ParallelClock :: cl1 -> cl2 -> Schedule m cl1 cl2 -> ParallelClock m cl1 cl2
[parallelCl1] :: ParallelClock m cl1 cl2 -> cl1
[parallelCl2] :: ParallelClock m cl1 cl2 -> cl2
[parallelSchedule] :: ParallelClock m cl1 cl2 -> Schedule m cl1 cl2

-- | The clock that represents the rate at which data enters the system.

-- | The clock that represents the rate at which data leaves the system.

-- | A tree representing possible last times to which the constituents of a
--   clock may have ticked.
data LastTime cl
[SequentialLastTime] :: LastTime cl1 -> LastTime cl2 -> LastTime (SequentialClock m cl1 cl2)
[ParallelLastTime] :: LastTime cl1 -> LastTime cl2 -> LastTime (ParallelClock m cl1 cl2)
[LeafLastTime] :: TimeDomainOf cl -> LastTime cl

-- | An inclusion of a clock into a tree of parallel compositions of
--   clocks.
data ParClockInclusion clS cl
[ParClockInL] :: ParClockInclusion (ParallelClock m clL clR) cl -> ParClockInclusion clL cl
[ParClockInR] :: ParClockInclusion (ParallelClock m clL clR) cl -> ParClockInclusion clR cl
[ParClockRefl] :: ParClockInclusion cl cl

-- | Generates a tag for the composite clock from a tag of a leaf clock,
--   given a parallel clock inclusion.
parClockTagInclusion :: ParClockInclusion clS cl -> Tag clS -> Tag cl
instance (GHC.Base.Monad m, FRP.Rhine.Clock.Clock m cl1, FRP.Rhine.Clock.Clock m cl2) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Schedule.ParallelClock m cl1 cl2)
instance (GHC.Base.Monad m, FRP.Rhine.Clock.Clock m cl1, FRP.Rhine.Clock.Clock m cl2) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Schedule.SequentialClock m cl1 cl2)

module FRP.Rhine.ResamplingBuffer

-- | A stateful buffer from which one may <a>get</a> a value, or to which
--   one may <a>put</a> a value, depending on the clocks.
--   <a>ResamplingBuffer</a>s can be clock-polymorphic, or specific to
--   certain clocks.
--   
--   <ul>
--   <li><tt>m</tt>: Monad in which the <a>ResamplingBuffer</a> may have
--   side effects</li>
--   <li><tt>cla</tt>: The clock at which data enters the buffer</li>
--   <li><tt>clb</tt>: The clock at which data leaves the buffer</li>
--   <li><tt>a</tt>: The input type</li>
--   <li><tt>b</tt>: The output type</li>
--   </ul>
data ResamplingBuffer m cla clb a b
ResamplingBuffer :: TimeInfo cla -> a -> m (ResamplingBuffer m cla clb a b) -> TimeInfo clb -> m (b, ResamplingBuffer m cla clb a b) -> ResamplingBuffer m cla clb a b

-- | Store one input value of type <tt>a</tt> at a given time stamp, and
--   return a continuation.
[put] :: ResamplingBuffer m cla clb a b -> TimeInfo cla -> a -> m (ResamplingBuffer m cla clb a b)

-- | Retrieve one output value of type <tt>b</tt> at a given time stamp,
--   and a continuation.
[get] :: ResamplingBuffer m cla clb a b -> TimeInfo clb -> m (b, ResamplingBuffer m cla clb a b)

-- | Hoist a <a>ResamplingBuffer</a> along a monad morphism.
hoistResamplingBuffer :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> ResamplingBuffer m1 cla clb a b -> ResamplingBuffer m2 cla clb a b

module FRP.Rhine.SF

-- | <a>SF</a> is an abbreviation for "signal function". It represents a
--   side-effectful asynchronous <i><b>s</b>ignal <b>f</b>unction</i>, or
--   signal network, where input, data processing (including side effects)
--   and output need not happen at the same time.
--   
--   The type parameters are:
--   
--   <ul>
--   <li><tt>m</tt>: The monad in which side effects take place.</li>
--   <li><tt>cl</tt>: The clock of the whole signal network. It may be
--   sequentially or parallely composed from other clocks.</li>
--   <li><tt>a</tt>: The input type. Input arrives at the rate <tt>Leftmost
--   cl</tt>.</li>
--   <li><tt>b</tt>: The output type. Output arrives at the rate
--   <tt>Rightmost cl</tt>.</li>
--   </ul>
data SF m cl a b

-- | A synchronous monadic stream function is the basic building block. For
--   such an <a>SF</a>, data enters and leaves the system at the same rate
--   as it is processed.
[Synchronous] :: (cl ~ Leftmost cl, cl ~ Rightmost cl) => SyncSF m cl a b -> SF m cl a b

-- | Two <a>SF</a>s may be sequentially composed if there is a matching
--   <a>ResamplingBuffer</a> between them.
[Sequential] :: (Clock m clab, Clock m clcd, TimeDomainOf clab ~ TimeDomainOf clcd, TimeDomainOf clab ~ TimeDomainOf (Rightmost clab), TimeDomainOf clcd ~ TimeDomainOf (Leftmost clcd)) => SF m clab a b -> ResamplingBuffer m (Rightmost clab) (Leftmost clcd) b c -> SF m clcd c d -> SF m (SequentialClock m clab clcd) a d

-- | Two <a>SF</a>s with the same input and output data may be parallely
--   composed.
[Parallel] :: (Clock m cl1, Clock m cl2, TimeDomainOf cl1 ~ TimeDomainOf (Rightmost cl1), TimeDomainOf cl2 ~ TimeDomainOf (Rightmost cl2), TimeDomainOf cl1 ~ TimeDomainOf cl2, TimeDomainOf cl1 ~ TimeDomainOf (Leftmost cl1), TimeDomainOf cl2 ~ TimeDomainOf (Leftmost cl2)) => SF m cl1 a b -> SF m cl2 a b -> SF m (ParallelClock m cl1 cl2) a b

module FRP.Rhine.Reactimation.Tick

-- | A signal function (<a>SF</a>) enclosed by matching
--   <a>ResamplingBuffer</a>s and further auxiliary data, such that it can
--   be stepped with each arriving tick from a clock <tt>cl</tt>. They play
--   a similar role like <tt>ReactHandle</tt>s in dunai.
--   
--   The type parameters:
--   
--   <ul>
--   <li><tt>m</tt>: The monad in which the <a>SF</a> and the
--   <a>ResamplingBuffer</a>s produce side effects</li>
--   <li><tt>cla</tt>: The (irrelevant) input clock of the left
--   <a>ResamplingBuffer</a></li>
--   <li><tt>clb</tt>: The clock at which the left <a>ResamplingBuffer</a>
--   produces output</li>
--   <li><tt>cl</tt>: The clock at which the <a>SF</a> ticks</li>
--   <li><tt>clc</tt>: The clock at which the right <a>ResamplingBuffer</a>
--   accepts input</li>
--   <li><tt>cld</tt>: The (irrelevant) output clock of the right
--   <a>ResamplingBuffer</a></li>
--   <li><tt>a</tt>: The (irrelevant) input type of the left
--   <a>ResamplingBuffer</a></li>
--   <li><tt>b</tt>: The input type of the <a>SF</a></li>
--   <li><tt>c</tt>: The output type of the <a>SF</a></li>
--   <li><tt>d</tt>: The (irrelevant) output type of the right
--   <a>ResamplingBuffer</a></li>
--   </ul>
data Tickable m cla clb cl clc cld a b c d
Tickable :: ResamplingBuffer m cla clb a b -> SF m cl b c -> ResamplingBuffer m clc cld c d -> ParClockInclusion (Leftmost cl) clb -> ParClockInclusion (Rightmost cl) clc -> LastTime cl -> TimeDomainOf cl -> Tickable m cla clb cl clc cld a b c d

-- | The left buffer from which the input is taken.
[buffer1] :: Tickable m cla clb cl clc cld a b c d -> ResamplingBuffer m cla clb a b

-- | The signal function that will process the data.
[ticksf] :: Tickable m cla clb cl clc cld a b c d -> SF m cl b c

-- | The right buffer in which the output is stored.
[buffer2] :: Tickable m cla clb cl clc cld a b c d -> ResamplingBuffer m clc cld c d

-- | The leftmost clock of the signal function, <tt>cl</tt>, may be a
--   parallel subclock of the buffer clock. <a>parClockInL</a> specifies in
--   which position 'Leftmost cl' is a parallel subclock of <tt>clb</tt>.
[parClockInL] :: Tickable m cla clb cl clc cld a b c d -> ParClockInclusion (Leftmost cl) clb

-- | The same on the output side.
[parClockInR] :: Tickable m cla clb cl clc cld a b c d -> ParClockInclusion (Rightmost cl) clc

-- | The last times when the different parts of the signal tree have
--   ticked.
[lastTime] :: Tickable m cla clb cl clc cld a b c d -> LastTime cl

-- | The time when the whole clock was initialised.
[initTime] :: Tickable m cla clb cl clc cld a b c d -> TimeDomainOf cl

-- | Initialise the tree of last tick times.
initLastTime :: SF m cl a b -> TimeDomainOf cl -> LastTime cl

-- | Initialise a <a>Tickable</a> from a signal function, two matching
--   enclosing resampling buffers and an initial time.
createTickable :: ResamplingBuffer m cla (Leftmost cl) a b -> SF m cl b c -> ResamplingBuffer m (Rightmost cl) cld c d -> TimeDomainOf cl -> Tickable m cla (Leftmost cl) cl (Rightmost cl) cld a b c d

-- | In this function, one tick, or step of an asynchronous signal function
--   happens. The <a>TimeInfo</a> holds the information which part of the
--   signal tree will tick. This information is encoded in the <a>Tag</a>
--   of the <a>TimeInfo</a>, which is of type 'Either tag1 tag2' in case of
--   a <a>SequentialClock</a> or a <a>ParallelClock</a>, encoding either a
--   tick for the left clock or the right clock.
tick :: (Monad m, Clock m cl, TimeDomainOf cla ~ TimeDomainOf cl, TimeDomainOf clb ~ TimeDomainOf cl, TimeDomainOf clc ~ TimeDomainOf cl, TimeDomainOf cld ~ TimeDomainOf cl, TimeDomainOf (Leftmost cl) ~ TimeDomainOf cl, TimeDomainOf (Rightmost cl) ~ TimeDomainOf cl) => Tickable m cla clb cl clc cld a b c d -> TimeDomainOf cl -> Tag cl -> m (Tickable m cla clb cl clc cld a b c d)

-- | A <a>ResamplingBuffer</a> producing only units. (Slightly more
--   efficient and direct implementation than the one in <a>Timeless</a>
--   that additionally unifies the clock types in a way needed for the tick
--   implementation.)
trivialResamplingBuffer :: Monad m => cl -> ResamplingBuffer m (Rightmost cl) (Leftmost cl) () ()

module FRP.Rhine.Reactimation

-- | An <a>SF</a> together with a clock of matching type <tt>cl</tt>, A
--   <a>Rhine</a> is a reactive program, possibly with open inputs and
--   outputs. If the input and output types <tt>a</tt> and <tt>b</tt> are
--   both '()', that is, the <a>Rhine</a> is "closed", then it is a
--   standalone reactive program that can be run with the function
--   <a>flow</a>.
data Rhine m cl a b
Rhine :: SF m cl a b -> cl -> Rhine m cl a b
[sf] :: Rhine m cl a b -> SF m cl a b
[clock] :: Rhine m cl a b -> cl

-- | Takes a closed <a>Rhine</a> (with trivial input and output), and runs
--   it indefinitely. All input is created, and all output is consumed by
--   means of side effects in a monad <tt>m</tt>.
--   
--   Basic usage (synchronous case):
--   
--   <pre>
--   sensor :: SyncSF MyMonad MyClock () a
--   sensor = arrMSync_ produceData
--   
--   processing :: SyncSF MyMonad MyClock a b
--   processing = ...
--   
--   actuator :: SyncSF MyMonad MyClock b ()
--   actuator = arrMSync consumeData
--   
--   mainSF :: SyncSF MyMonad MyClock () ()
--   mainSF = sensor &gt;-&gt; processing &gt;-&gt; actuator
--   
--   main :: MyMonad ()
--   main = flow $ mainSF @@ clock
--   </pre>
flow :: (Monad m, Clock m cl, TimeDomainOf cl ~ TimeDomainOf (Leftmost cl), TimeDomainOf cl ~ TimeDomainOf (Rightmost cl)) => Rhine m cl () () -> m ()


-- | General mnemonic for combinators:
--   
--   <ul>
--   <li>@ annotates a data processing unit such as a signal function or a
--   buffer with temporal information like a clock or a schedule.</li>
--   <li><tt>*</tt> composes parallely.</li>
--   <li><tt>&gt;</tt> composes sequentially.</li>
--   </ul>
module FRP.Rhine.SF.Combinators

-- | Create a synchronous <a>Rhine</a> by combining a synchronous SF with a
--   matching clock. Synchronicity is ensured by requiring that data enters
--   (<tt>Leftmost cl</tt>) and leaves (<tt>Rightmost cl</tt>) the system
--   at the same as it is processed (<tt>cl</tt>).
(@@) :: (cl ~ Leftmost cl, cl ~ Rightmost cl) => SyncSF m cl a b -> cl -> Rhine m cl a b
infix 5 @@

-- | A point at which sequential asynchronous composition ("resampling") of
--   signal functions can happen.
data ResamplingPoint m cla clb a b
ResamplingPoint :: (ResamplingBuffer m (Rightmost cla) (Leftmost clb) a b) -> (Schedule m cla clb) -> ResamplingPoint m cla clb a b

-- | Syntactic sugar for <a>ResamplingPoint</a>.
(-@-) :: ResamplingBuffer m (Rightmost cl1) (Leftmost cl2) a b -> Schedule m cl1 cl2 -> ResamplingPoint m cl1 cl2 a b
infix 8 -@-

-- | A purely syntactical convenience construction enabling quadruple
--   syntax for sequential composition, as described below.
data RhineAndResamplingPoint m cl1 cl2 a c
RhineAndResamplingPoint :: (Rhine m cl1 a b) -> (ResamplingPoint m cl1 cl2 b c) -> RhineAndResamplingPoint m cl1 cl2 a c

-- | Syntactic sugar for <a>RhineAndResamplingPoint</a>.
(>--) :: Rhine m cl1 a b -> ResamplingPoint m cl1 cl2 b c -> RhineAndResamplingPoint m cl1 cl2 a c
infix 2 >--

-- | The combinators for sequential composition allow for the following
--   syntax:
--   
--   <pre>
--   rh1   :: Rhine            m            cl1                 a b
--   rh1   =  ...
--   
--   rh2   :: Rhine            m                           cl2      c d
--   rh2   =  ...
--   
--   rb    :: ResamplingBuffer m (Rightmost cl1) (Leftmost cl2)   b c
--   rb    =  ...
--   
--   sched :: Schedule         m            cl1            cl2
--   sched =  ...
--   
--   rh    :: Rhine            m (SequentialClock cl1 cl2)      a     d
--   rh    =  rh1 &gt;-- rb -@- sched --&gt; rh2
--   </pre>
(-->) :: (Clock m cl1, Clock m cl2, TimeDomainOf cl1 ~ TimeDomainOf cl2, TimeDomainOf (Rightmost cl1) ~ TimeDomainOf cl1, TimeDomainOf (Leftmost cl2) ~ TimeDomainOf cl2, Clock m (Rightmost cl1), Clock m (Leftmost cl2)) => RhineAndResamplingPoint m cl1 cl2 a b -> Rhine m cl2 b c -> Rhine m (SequentialClock m cl1 cl2) a c
infixr 1 -->

-- | A purely syntactical convenience construction allowing for ternary
--   syntax for parallel composition, described below.
data RhineParallelAndSchedule m cl1 cl2 a b
RhineParallelAndSchedule :: (Rhine m cl1 a b) -> (Schedule m cl1 cl2) -> RhineParallelAndSchedule m cl1 cl2 a b

-- | Syntactic sugar for <a>RhineParallelAndSchedule</a>.
(**@) :: Rhine m cl1 a b -> Schedule m cl1 cl2 -> RhineParallelAndSchedule m cl1 cl2 a b
infix 4 **@

-- | The combinators for parallel composition allow for the following
--   syntax:
--   
--   <pre>
--   rh1   :: Rhine    m                cl1      a b
--   rh1   =  ...
--   
--   rh2   :: Rhine    m                    cl2  a b
--   rh2   =  ...
--   
--   sched :: Schedule m                cl1 cl2
--   sched =  ...
--   
--   rh    :: Rhine    m (ParallelClock cl1 cl2) a b
--   rh    =  rh1 **@ sched @** rh2
--   </pre>
(@**) :: (Clock m cl1, Clock m cl2, TimeDomainOf cl1 ~ TimeDomainOf (Rightmost cl1), TimeDomainOf cl2 ~ TimeDomainOf (Rightmost cl2), TimeDomainOf cl1 ~ TimeDomainOf (Leftmost cl1), TimeDomainOf cl2 ~ TimeDomainOf (Leftmost cl2), TimeDomainOf cl1 ~ TimeDomainOf cl2) => RhineParallelAndSchedule m cl1 cl2 a b -> Rhine m cl2 a b -> Rhine m (ParallelClock m cl1 cl2) a b
infix 3 @**


-- | This module reexports most common names and combinators you will need
--   to work with Rhine. It does not export specific clocks, resampling
--   buffers or schedules, so you will have to import those yourself, e.g.
--   like this:
--   
--   <pre>
--   import FRP.Rhine
--   import FRP.Rhine.Clock.Realtime.Millisecond
--   
--   main :: IO ()
--   main = flow $ arrMSync_ (putStrLn "Hello World!") @@ (waitClock :: Millisecond 100)
--   </pre>
module FRP.Rhine

module FRP.Rhine.SyncSF.Except

-- | Compatibility to U.S. american spelling.
type BehaviorFExcept m td a b e = BehaviourFExcept m td a b e

-- | A clock polymorphic <a>SyncExcept</a>. Any clock with time domain
--   <tt>td</tt> may occur.
type BehaviourFExcept m td a b e = forall cl. td ~ TimeDomainOf cl => SyncExcept m cl a b e

-- | A synchronous exception-throwing signal function. It is based on a
--   <tt>newtype</tt>, <a>MSFExcept</a>, to exhibit a monad interface <i>in
--   the exception type</i>. <a>return</a> then corresponds to throwing an
--   exception, and `(&gt;&gt;=)` is exception handling. (For more
--   information, see the documentation of <a>MSFExcept</a>.)
--   
--   <ul>
--   <li><tt>m</tt>: The monad that the signal function may take side
--   effects in</li>
--   <li><tt>cl</tt>: The clock on which the signal function ticks</li>
--   <li><tt>a</tt>: The input type</li>
--   <li><tt>b</tt>: The output type</li>
--   <li><tt>e</tt>: The type of exceptions that can be thrown</li>
--   </ul>
type SyncExcept m cl a b e = MSFExcept (ReaderT (TimeInfo cl) m) a b e
commuteExceptReader :: ExceptT e (ReaderT r m) a -> ReaderT r (ExceptT e m) a
runSyncExcept :: Monad m => SyncExcept m cl a b e -> SyncSF (ExceptT e m) cl a b

-- | Enter the monad context in the exception for |SyncSF|s in the
--   |ExceptT| monad. The <a>SyncSF</a> will be run until it encounters an
--   exception.
try :: Monad m => SyncSF (ExceptT e m) cl a b -> SyncExcept m cl a b e

-- | Within the same tick, perform a monadic action, and immediately throw
--   the value as an exception.
once :: Monad m => (a -> m e) -> SyncExcept m cl a b e

-- | A variant of |once| without input.
once_ :: Monad m => m e -> SyncExcept m cl a b e

-- | Immediately throw the exception on the input.
throwS :: Monad m => SyncSF (ExceptT e m) cl e a

-- | Throw the given exception when the <a>Bool</a> turns true.
throwOn :: Monad m => e -> SyncSF (ExceptT e m) cl Bool ()

-- | Variant of <a>throwOn</a>, where the exception can vary every tick.
throwOn' :: Monad m => SyncSF (ExceptT e m) cl (Bool, e) ()

-- | Advances a single tick with the given Kleisli arrow, and then throws
--   an exception.
step :: Monad m => (a -> m (b, e)) -> SyncExcept m cl a b e

-- | Remembers and indefinitely outputs the first input value.
keepFirst :: Monad m => SyncSF m cl a a

-- | Throws an exception after the specified time difference, outputting
--   the remaining time difference.
timer :: (Monad m, TimeDomain td, Ord (Diff td)) => Diff td -> BehaviorF (ExceptT () m) td a (Diff td)

-- | Like <a>timer</a>, but divides the remaining time by the total time.
scaledTimer :: (Monad m, TimeDomain td, Fractional (Diff td), Ord (Diff td)) => Diff td -> BehaviorF (ExceptT () m) td a (Diff td)

-- | An <a>MSF</a> without an <a>ExceptT</a> layer never throws an
--   exception, and can thus have an arbitrary exception type.
safe :: Monad m => MSF m a b -> MSFExcept m a b e

-- | If no exception can occur, the <a>MSF</a> can be executed without the
--   <a>ExceptT</a> layer.
safely :: Monad m => MSFExcept m a b Empty -> MSF m a b

-- | The empty type. As an exception type, it encodes "no exception
--   possible".
data Empty

-- | Escape an <a>ExceptT</a> layer by outputting the exception whenever it
--   occurs. If an exception occurs, the current <a>MSF</a> continuation is
--   tested again on the next input.
exceptS :: Monad m => MSF ExceptT e m a b -> MSF m a Either e b
runMSFExcept :: MSFExcept m a b e -> MSF ExceptT e m a b

module FRP.Rhine.Schedule.Trans

-- | Two clocks in the <a>ScheduleT</a> monad transformer can always be
--   canonically scheduled. Indeed, this is the purpose for which
--   <a>ScheduleT</a> was defined.
schedule :: (Monad m, Clock (ScheduleT (Diff (TimeDomainOf cl1)) m) cl1, Clock (ScheduleT (Diff (TimeDomainOf cl1)) m) cl2, TimeDomainOf cl1 ~ TimeDomainOf cl2, Ord (Diff (TimeDomainOf cl1)), Num (Diff (TimeDomainOf cl1))) => Schedule (ScheduleT (Diff (TimeDomainOf cl1)) m) cl1 cl2

module FRP.Rhine.Schedule.Concurrently

-- | Runs two clocks in separate GHC threads and collects the results in
--   the foreground thread. Caution: The data processing will still happen
--   in the same thread (since data processing and scheduling are separated
--   concerns).
concurrently :: (Clock IO cl1, Clock IO cl2, TimeDomainOf cl1 ~ TimeDomainOf cl2) => Schedule IO cl1 cl2

module FRP.Rhine.ResamplingBuffer.Util

-- | Postcompose a <a>ResamplingBuffer</a> with a matching <a>SyncSF</a>.
(>>-^) :: Monad m => ResamplingBuffer m cl1 cl2 a b -> SyncSF m cl2 b c -> ResamplingBuffer m cl1 cl2 a c
infix 2 >>-^

-- | Precompose a <a>ResamplingBuffer</a> with a matching <a>SyncSF</a>.
(^->>) :: Monad m => SyncSF m cl1 a b -> ResamplingBuffer m cl1 cl2 b c -> ResamplingBuffer m cl1 cl2 a c
infix 1 ^->>

-- | Parallely compose two <a>ResamplingBuffer</a>s.
(*-*) :: Monad m => ResamplingBuffer m cl1 cl2 a b -> ResamplingBuffer m cl1 cl2 c d -> ResamplingBuffer m cl1 cl2 (a, c) (b, d)
infix 4 *-*

-- | Given a <a>ResamplingBuffer</a> where the output type depends on the
--   input type polymorphically, we can produce a timestamped version that
--   simply annotates every input value with the <a>TimeInfo</a> when it
--   arrived.
timestamped :: Monad m => (forall b. ResamplingBuffer m cl clf b (f b)) -> ResamplingBuffer m cl clf a (f (a, TimeInfo cl))

module FRP.Rhine.ResamplingBuffer.Timeless

-- | An asynchronous, effectful Mealy machine description. (Input and
--   output do not happen simultaneously.) It can be used to create
--   <a>ResamplingBuffer</a>s.
data AsyncMealy m s a b
AsyncMealy :: s -> a -> m s -> s -> m (b, s) -> AsyncMealy m s a b

-- | Given the previous state and an input value, return the new state.
[amPut] :: AsyncMealy m s a b -> s -> a -> m s

-- | Given the previous state, return an output value and a new state.
[amGet] :: AsyncMealy m s a b -> s -> m (b, s)

-- | A resampling buffer that is unaware of the time information of the
--   clock, and thus clock-polymorphic. It is built from an asynchronous
--   Mealy machine description. Whenever <a>get</a> is called on
--   <tt>timelessResamplingBuffer machine s</tt>, the method <a>amGet</a>
--   is called on <tt>machine</tt> with state <tt>s</tt>, discarding the
--   time stamp. Analogously for <a>put</a>.
timelessResamplingBuffer :: Monad m => AsyncMealy m s a b -> s -> ResamplingBuffer m cl1 cl2 a b

-- | A resampling buffer that only accepts and emits units.
trivialResamplingBuffer :: Monad m => ResamplingBuffer m cl1 cl2 () ()

module FRP.Rhine.ResamplingBuffer.KeepLast

-- | Always keeps the last input value, or in case of no input an
--   initialisation value.
keepLast :: Monad m => a -> ResamplingBuffer m cl1 cl2 a a

module FRP.Rhine.ResamplingBuffer.FIFO

-- | An unbounded FIFO buffer. If the buffer is empty, it will return
--   <a>Nothing</a>.
fifo :: Monad m => ResamplingBuffer m cl1 cl2 a (Maybe a)

-- | An unbounded FIFO buffer that also returns its current size.
fifoWatch :: Monad m => ResamplingBuffer m cl1 cl2 a (Maybe a, Int)

module FRP.Rhine.ResamplingBuffer.Collect

-- | Collects all input in a list, with the newest element at the head,
--   which is returned and emptied upon <a>get</a>.
collect :: Monad m => ResamplingBuffer m cl1 cl2 a [a]

-- | Reimplementation of <a>collect</a> with sequences, which gives a
--   performance benefit if the sequence needs to be reversed or searched.
collectSequence :: Monad m => ResamplingBuffer m cl1 cl2 a (Seq a)

-- | <a>pureBuffer</a> collects all input values lazily in a list and
--   processes it when output is required. Semantically, <tt>pureBuffer f
--   == collect &gt;&gt;-^ arr f</tt>, but <a>pureBuffer</a> is slightly
--   more efficient.
pureBuffer :: Monad m => ([a] -> b) -> ResamplingBuffer m cl1 cl2 a b

-- | A buffer collecting all incoming values with a folding function. It is
--   strict, i.e. the state value <tt>b</tt> is calculated on every
--   <a>put</a>.
foldBuffer :: Monad m => (a -> b -> b) -> b -> ResamplingBuffer m cl1 cl2 a b

module FRP.Rhine.ResamplingBuffer.MSF

-- | Given a monadic stream function that accepts a varying number of
--   inputs (a list), a <a>ResamplingBuffer</a> can be formed that collects
--   all input in a timestamped list
msfBuffer :: Monad m => MSF m (TimeInfo cl2, [(TimeInfo cl1, a)]) b -> ResamplingBuffer m cl1 cl2 a b

module FRP.Rhine.ResamplingBuffer.Interpolation

-- | A simple linear interpolation based on the last calculated position
--   and velocity.
linear :: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl1), Groundfield v ~ Diff (TimeDomainOf cl2)) => v -> v -> ResamplingBuffer m cl1 cl2 v v

module FRP.Rhine.Clock.Step

-- | A pure (side effect free) clock ticking at multiples of <tt>n</tt>.
--   The tick rate is in the type signature, which prevents composition of
--   signals at different rates.
data Step (n :: Nat)
[Step] :: KnownNat n => Step n

-- | Extract the type-level natural number as an integer.
stepsize :: Step n -> Integer

-- | Two <a>Step</a> clocks can always be scheduled without side effects.
scheduleStep :: Monad m => Schedule m (Step n1) (Step n2)
instance GHC.Base.Monad m => FRP.Rhine.Clock.Clock m (FRP.Rhine.Clock.Step.Step n)

module FRP.Rhine.Clock.Select

-- | A clock that selects certain subevents of type <tt>a</tt>, from the
--   tag of a main clock.
data SelectClock cl a
SelectClock :: cl -> Tag cl -> Maybe a -> SelectClock cl a

-- | The main clock | Return <a>Nothing</a> if no tick of the subclock is
--   required, or 'Just a' if the subclock should tick, with tag
--   <tt>a</tt>.
[mainClock] :: SelectClock cl a -> cl
[select] :: SelectClock cl a -> Tag cl -> Maybe a

-- | A universal schedule for two subclocks of the same main clock. The
--   main clock must be a monoid (e.g. a singleton).
schedSelectClocks :: (Monad m, Monoid cl, Clock m cl) => Schedule m (SelectClock cl a) (SelectClock cl b)

-- | Helper function that runs an <a>MSF</a> with <a>Maybe</a> output until
--   it returns a value.
filterS :: Monad m => MSF m () (Maybe b) -> MSF m () b
instance (GHC.Base.Monad m, FRP.Rhine.Clock.Clock m cl) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Clock.Select.SelectClock cl a)

module FRP.Rhine.Clock.Realtime.Stdin

-- | A clock that ticks for every line entered on the console, outputting
--   the entered line as its |Tag|.
data StdinClock
StdinClock :: StdinClock
instance Control.Monad.IO.Class.MonadIO m => FRP.Rhine.Clock.Clock m FRP.Rhine.Clock.Realtime.Stdin.StdinClock
instance GHC.Base.Semigroup FRP.Rhine.Clock.Realtime.Stdin.StdinClock
instance GHC.Base.Monoid FRP.Rhine.Clock.Realtime.Stdin.StdinClock

module FRP.Rhine.Clock.Realtime.Millisecond

-- | A clock ticking every <tt>n</tt> milliseconds, in real time. Since
--   <tt>n</tt> is in the type signature, it is ensured that when composing
--   two signals on a <a>Millisecond</a> clock, they will be driven at the
--   same rate.
--   
--   The tag of this clock is <a>Bool</a>, where <a>True</a> represents
--   successful realtime, and <a>False</a> a lag.
type Millisecond (n :: Nat) = RescaledClockS IO (Step n) UTCTime Bool

-- | This clock simply sleeps <tt>n</tt> milliseconds after each tick. The
--   current time is measured, but no adjustment is made. Consequently, the
--   tag is constantly <a>False</a>, since the clock will accumulate the
--   computation time as lag.
sleepClock :: KnownNat n => Millisecond n

-- | A more sophisticated implementation that measures the time after each
--   tick, and waits for the remaining time until the next tick. If the
--   next tick should already have occurred, the tag is set to
--   <a>False</a>, representing a failed real time attempt.
waitClock :: KnownNat n => Millisecond n

module FRP.Rhine.Clock.Realtime.Busy

-- | A clock that ticks without waiting. All time passed between ticks
--   amounts to computation time, side effects, time measurement and
--   framework overhead.
data Busy
Busy :: Busy
instance FRP.Rhine.Clock.Clock GHC.Types.IO FRP.Rhine.Clock.Realtime.Busy.Busy

module FRP.Rhine.Clock.Realtime.Audio

-- | A clock for audio analysis and synthesis. It internally processes
--   samples in buffers of size <tt>bufferSize</tt>, (the programmer does
--   not have to worry about this), at a sample rate of <tt>rate</tt> (of
--   type <a>AudioRate</a>). Both these parameters are in the type
--   signature, so it is not possible to compose signals with different
--   buffer sizes or sample rates.
--   
--   After processing a buffer, the clock will wait the remaining time
--   until the next buffer must be processed, using system UTC time. The
--   tag of the clock specifies whether the attempt to finish the last
--   buffer in real time was successful. A value of <a>Nothing</a>
--   represents success, a value of <tt>Just double</tt> represents a lag
--   of <tt>double</tt> seconds.
data AudioClock (rate :: AudioRate) (bufferSize :: Nat)
AudioClock :: AudioClock

-- | Rates at which audio signals are typically sampled.
data AudioRate
Hz44100 :: AudioRate
Hz48000 :: AudioRate
Hz96000 :: AudioRate

-- | A side-effect free clock for audio synthesis and analysis. The sample
--   rate is given by <tt>rate</tt> (of type <a>AudioRate</a>). Since this
--   clock does not wait for the completion of buffers, the producer or the
--   consumer of the signal has the obligation to synchronise the signal
--   with the system clock, if realtime is desired. Otherwise, the clock is
--   also suitable e.g. for batch processing of audio files.
data PureAudioClock (rate :: AudioRate)
PureAudioClock :: PureAudioClock
pureAudioClockF :: PureAudioClockF rate
instance (GHC.Base.Monad m, FRP.Rhine.Clock.Realtime.Audio.PureAudioClockRate rate) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Clock.Realtime.Audio.PureAudioClock rate)
instance FRP.Rhine.Clock.Realtime.Audio.AudioClockRate 'FRP.Rhine.Clock.Realtime.Audio.Hz44100
instance FRP.Rhine.Clock.Realtime.Audio.AudioClockRate 'FRP.Rhine.Clock.Realtime.Audio.Hz48000
instance FRP.Rhine.Clock.Realtime.Audio.AudioClockRate 'FRP.Rhine.Clock.Realtime.Audio.Hz96000
instance (Control.Monad.IO.Class.MonadIO m, GHC.TypeNats.KnownNat bufferSize, FRP.Rhine.Clock.Realtime.Audio.AudioClockRate rate) => FRP.Rhine.Clock.Clock m (FRP.Rhine.Clock.Realtime.Audio.AudioClock rate bufferSize)

module FRP.Rhine.Clock.FixedRate

-- | A side-effect-free clock ticking at a fixed rate.
newtype FixedRate
FixedRate :: Double -> FixedRate
instance GHC.Base.Monad m => FRP.Rhine.Clock.Clock m FRP.Rhine.Clock.FixedRate.FixedRate

module FRP.Rhine.Clock.Count

-- | A singleton clock that counts the ticks.
data Count
Count :: Count
instance GHC.Base.Monad m => FRP.Rhine.Clock.Clock m FRP.Rhine.Clock.Count.Count
