Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- 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 given action once after the given delay elapsed, no sooner, maybe later.
:: TimerIO | |
-> IO () | The action the timer will start with. |
-> Delay | The delay the timer will start with. |
-> IO Bool |
Attempts to start a timer. The started timer will have the given delay and action associated with it and will be one-shot timer.
If the timer was initialized before it will be stopped (killed) and started anew.
Returns True if the start was successful, otherwise (e.g. other thread is attempting to manipulate the timer) returns False.
oneShotRestart :: TimerIO -> IO Bool Source #
Attempts to restart already initialized timer. The restarted timer will have the same delay and action associated with it and will be one-shot timer.
Returns True if the restart was successful, otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False.
Executes the given action repeatedly with at least the given delay between executions.
:: TimerIO | |
-> IO () | The action the timer will start with. |
-> Delay | The delay the timer will start with. |
-> IO Bool |
Attempts to start a timer. The started timer will have the given delay and action associated with it and will be repeated timer.
If the timer was initialized before it will be stopped (killed) and started anew.
Returns True if the start was successful, otherwise (e.g. other thread is attempting to manipulate the timer) returns False.
repeatedRestart :: TimerIO -> IO Bool Source #
Attempts to restart already initialized timer. The restarted timer will have the same delay and action associated with it and will be one-shot timer.
Returns True if the restart was successful, otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False.