Safe Haskell | Safe-Infered |
---|
- data Timer m
- type TimerIO = Timer IO
- oneShotTimer :: IO () -> Delay -> IO TimerIO
- oneShotStart :: TimerIO -> IO () -> Delay -> IO Bool
- oneShotRestart :: TimerIO -> IO Bool
- repeatedTimer :: IO () -> Delay -> IO TimerIO
- repeatedStart :: TimerIO -> IO () -> Delay -> IO Bool
- repeatedRestart :: TimerIO -> IO Bool
- newTimer :: IO TimerIO
- stopTimer :: TimerIO -> IO ()
Documentation
The data type representing the timer. For now, the action and delay are fixed for the lifetime of the Timer.
:: IO () | The action to be executed. |
-> Delay | The (minimal) time until the execution in microseconds. |
-> IO TimerIO |
Executes the the given action once after the given delay elapsed, no sooner, maybe later.
:: TimerIO | |
-> IO () | The action the timer will start with. |
-> Delay | The dealy the timer will start with. |
-> IO Bool |
Attempts to start a timer. The started timer will have the given delay and action associated and will be one-shot timer.
If the timer was already initialized, it the previous timer will be stoped (the thread killed) and the timer will be started anew.
Returns True if the strat was successful, otherwise (e.g. other thread is attempting to manipulate the timer) returns False.
oneShotRestart :: TimerIO -> IO BoolSource
Attempts to restart already initialized timer. The restarted timer will have the same delay and action associated and will be one-shot timer.
Returns True if the restrat was successful, otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False.
Executes the the given action repeatedly with at least the given delay between executions.
:: TimerIO | |
-> IO () | The action the timer will start with. |
-> Delay | The dealy the timer will start with. |
-> IO Bool |
Attempts to start a timer. The started timer will have the given delay and action associated and will be repeated timer.
If the timer was already initialized, it the previous timer will be stoped (the thread killed) and the timer will be started anew.
Returns True if the strat was successful, otherwise (e.g. other thread is attempting to manipulate the timer) returns False.
repeatedRestart :: TimerIO -> IO BoolSource
Attempts to restart already initialized timer. The restarted timer will have the same delay and action associated and will be one-shot timer.
Returns True if the restrat was successful, otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False.