Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides a clock that ticks at every multiple of a fixed number of milliseconds.
Synopsis
- newtype Millisecond (n :: Nat) = Millisecond (RescaledClockS IO (FixedStep n) UTCTime Bool)
- waitClock :: KnownNat n => Millisecond n
- downsampleMillisecond :: (KnownNat n, Monad m) => ResamplingBuffer m (Millisecond k) (Millisecond (n * k)) a (Vector n a)
- scheduleMillisecond :: Schedule IO (Millisecond n1) (Millisecond n2)
Documentation
newtype Millisecond (n :: Nat) Source #
A clock ticking every n
milliseconds,
in real time.
Since n
is in the type signature,
it is ensured that when composing two signals on a Millisecond
clock,
they will be driven at the same rate.
The tag of this clock is Bool
,
where True
represents successful realtime,
and False
a lag.
Instances
Clock IO (Millisecond n) Source # | |
Defined in FRP.Rhine.Clock.Realtime.Millisecond type Time (Millisecond n) :: * Source # type Tag (Millisecond n) :: * Source # initClock :: Millisecond n -> RunningClockInit IO (Time (Millisecond n)) (Tag (Millisecond n)) Source # | |
type Time (Millisecond n) Source # | |
Defined in FRP.Rhine.Clock.Realtime.Millisecond | |
type Tag (Millisecond n) Source # | |
Defined in FRP.Rhine.Clock.Realtime.Millisecond |
waitClock :: KnownNat n => Millisecond n Source #
This implementation 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 False
, representing a failed real time attempt.
downsampleMillisecond :: (KnownNat n, Monad m) => ResamplingBuffer m (Millisecond k) (Millisecond (n * k)) a (Vector n a) Source #
scheduleMillisecond :: Schedule IO (Millisecond n1) (Millisecond n2) Source #
Two Millisecond
clocks can always be scheduled deterministically.