reflex-0.5.0.1: Higher-order Functional Reactive Programming

Safe HaskellNone
LanguageHaskell98

Reflex.Time

Synopsis

Documentation

data TickInfo Source #

Constructors

TickInfo 

Fields

Instances
Eq TickInfo Source # 
Instance details

Defined in Reflex.Time

Ord TickInfo Source # 
Instance details

Defined in Reflex.Time

Show TickInfo Source # 
Instance details

Defined in Reflex.Time

tickLossy :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> UTCTime -> m (Event t TickInfo) Source #

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 #

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.

tickLossyFrom Source #

Arguments

:: (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

-> 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) 

Send events over time with the given basis time and interval 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 basis time

tickLossyFrom' Source #

Arguments

:: (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 getPostBuild that only fires once. But there could be uses for starting multiple timer threads.

-> m (Event t TickInfo) 

Generalization of tickLossyFrom that takes dt and t0 in the event.

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.

poissonLossyFrom Source #

Arguments

:: (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

poissonLossy Source #

Arguments

:: (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 #

When the given Event occurs, wait the given amount of time and collect all occurrences during that time. Then, fire the output Event with the collected output.

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.