Safe Haskell | None |
---|---|
Language | Haskell2010 |
- Immediate mode must turn off whenever output is produced.
- Output must be produced whenever immediate mode turns from on to off.
- Immediate mode can only go from off to on when the delayed event fires.
- Every input firing must go into either an immediate output firing or the
- An existing full buffer must either stay in the buffer or go to output,
Synopsis
- data TickInfo = TickInfo {}
- tickLossy :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> UTCTime -> m (Event t TickInfo)
- tickLossyFromPostBuildTime :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> m (Event t TickInfo)
- tickLossyFrom :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> UTCTime -> Event t a -> m (Event t TickInfo)
- tickLossyFrom' :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => Event t (NominalDiffTime, UTCTime) -> m (Event t TickInfo)
- clockLossy :: (MonadIO m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), PostBuild t m, MonadHold t m, MonadFix m) => NominalDiffTime -> UTCTime -> m (Dynamic t TickInfo)
- getCurrentTick :: NominalDiffTime -> UTCTime -> IO TickInfo
- delay :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a)
- poissonLossyFrom :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => g -> Double -> UTCTime -> Event t a -> m (Event t TickInfo)
- poissonLossy :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m, PostBuild t m) => g -> Double -> UTCTime -> m (Event t TickInfo)
- inhomogeneousPoissonFrom :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => g -> Behavior t Double -> Double -> UTCTime -> Event t a -> m (Event t TickInfo)
- inhomogeneousPoisson :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m, PostBuild t m) => g -> Behavior t Double -> Double -> UTCTime -> m (Event t TickInfo)
- debounce :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a)
- batchOccurrences :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t (Seq a))
- throttle :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a)
- data ThrottleState b
- data ThrottleBuffer b
- throttleBatchWithLag :: (MonadFix m, MonadHold t m, PerformEvent t m, Semigroup a) => (Event t () -> m (Event t ())) -> Event t a -> m (Event t a)
- tickInfo_n :: Lens' TickInfo Integer
- tickInfo_lastUTC :: Lens' TickInfo UTCTime
- tickInfo_alreadyElapsed :: Lens' TickInfo NominalDiffTime
Documentation
Metadata associated with a timer "tick"
TickInfo | |
|
tickLossy :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> UTCTime -> m (Event t TickInfo) Source #
Fires an Event
once every time provided interval elapses, approximately.
The provided UTCTime
is used bootstrap the determination of how much time has elapsed with each tick.
This is a special case of tickLossyFrom
that uses the post-build event to start the tick thread.
tickLossyFromPostBuildTime :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> m (Event t TickInfo) Source #
Fires an Event
once every time provided interval elapses, approximately.
This is a special case of tickLossyFrom
that uses the post-build event to start the tick thread and the time of the post-build as the tick basis time.
:: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) | |
=> NominalDiffTime | The length of a tick interval |
-> UTCTime | The basis time from which intervals count and with which the initial calculation of elapsed time will be made. |
-> Event t a | Event that starts a tick generation thread. Usually you want this to be something like the result of getPostBuild that only fires once. But there could be uses for starting multiple timer threads. |
-> m (Event t TickInfo) |
Fires an Event
approximately each time the provided interval elapses. If the system starts running behind, occurrences will be dropped rather than buffered.
Each occurrence of the resulting event will contain the index of the current interval, with 0 representing the provided initial time.
:: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) | |
=> Event t (NominalDiffTime, UTCTime) | Event that starts a tick generation thread. Usually you want this to
be something like the result of |
-> m (Event t TickInfo) |
Generalization of tickLossyFrom that takes the delay and initial time as an Event
.
clockLossy :: (MonadIO m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), PostBuild t m, MonadHold t m, MonadFix m) => NominalDiffTime -> UTCTime -> m (Dynamic t TickInfo) Source #
getCurrentTick :: NominalDiffTime -> UTCTime -> IO TickInfo Source #
delay :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a) Source #
Delay an Event's occurrences by a given amount in seconds.
:: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) | |
=> g | |
-> Double | Poisson event rate (Hz) |
-> UTCTime | Baseline time for events |
-> Event t a | Event that starts a tick generation thread. Usually you want this to be something like the result of getPostBuild that only fires once. But there could be uses for starting multiple timer threads. Start sending events in response to the event parameter. |
-> m (Event t TickInfo) |
Send events with Poisson timing with the given basis and rate Each occurrence of the resulting event will contain the index of the current interval, with 0 representing the basis time
:: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m, PostBuild t m) | |
=> g | |
-> Double | Poisson event rate (Hz) |
-> UTCTime | Baseline time for events |
-> m (Event t TickInfo) |
Send events with Poisson timing with the given basis and rate Each occurrence of the resulting event will contain the index of the current interval, with 0 representing the basis time. Automatically begin sending events when the DOM is built
inhomogeneousPoissonFrom :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => g -> Behavior t Double -> Double -> UTCTime -> Event t a -> m (Event t TickInfo) Source #
Send events with inhomogeneous Poisson timing with the given basis and variable rate. Provide a maxRate that you expect to support.
inhomogeneousPoisson :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m, PostBuild t m) => g -> Behavior t Double -> Double -> UTCTime -> m (Event t TickInfo) Source #
Send events with inhomogeneous Poisson timing with the given basis and variable rate. Provide a maxRate that you expect to support
debounce :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a) Source #
Block occurrences of an Event until the given number of seconds elapses without the Event firing, at which point the last occurrence of the Event will fire.
batchOccurrences :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t (Seq a)) Source #
throttle :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a) Source #
Throttle an input event, ensuring that at least a given amount of time passes between occurrences of the output event. If the input event occurs too frequently, the output event occurs with the most recently seen input value after the given delay passes since the last occurrence of the output. If the output event has not occurred recently, occurrences of the input event will cause the output event to fire immediately.
data ThrottleState b Source #
Instances
data ThrottleBuffer b Source #
Instances
throttleBatchWithLag :: (MonadFix m, MonadHold t m, PerformEvent t m, Semigroup a) => (Event t () -> m (Event t ())) -> Event t a -> m (Event t a) Source #
Throttle an input event, ensuring that the output event doesn't occur more often than you are ready for it. If the input event occurs too
frequently, the output event will contain semigroup-based summaries of the input firings that happened since the last output firing.
If the output event has not occurred recently, occurrences of the input event will cause the output event to fire immediately.
The first parameter is a function that receives access to the output event, and should construct an event that fires when the receiver is
ready for more input. For example, using delay 20
would give a simple time-based throttle.
NB: The provided lag function must *actually* delay the event.