Safe Haskell | None |
---|---|
Language | Haskell2010 |
Manage a timer running in a dedicated thread. You specify an amount of time an and action. The timer waits for that amount of time, and then runs the action. You can stop and restart it at any time.
- data TimerSettings n
- tsDelay :: TimerSettings n -> TimeInterval
- tsRun :: TimerSettings n -> n () -> IO ()
- tsAction :: TimerSettings n -> n ()
- data Timer n
- newTimer :: (MonadIO m, MonadIO n, MonadCatch n) => TimerSettings n -> m (Timer n)
- releaseTimer :: MonadIO m => Timer n -> m ()
- withTimer :: (MonadIO m, MonadMask m, MonadIO n, MonadCatch n) => TimerSettings n -> (Timer n -> m a) -> m a
- startTimer :: MonadIO m => Timer n -> m ()
- startTimer' :: (TimeUnit t, MonadIO m) => Timer n -> t -> m ()
- startTimerWith :: (TimeUnit t, MonadIO m) => Timer n -> Maybe t -> Maybe (n ()) -> m ()
- stopTimer :: MonadIO m => Timer n -> m ()
- restartTimer :: MonadIO m => Timer n -> m ()
- restartTimer' :: (TimeUnit t, MonadIO m) => Timer n -> t -> m ()
- restartTimerWith :: (TimeUnit t, MonadIO m) => Timer n -> Maybe t -> Maybe (n ()) -> m ()
Settings
data TimerSettings n Source
MonadIO n => Default (TimerSettings n) Source |
tsDelay :: TimerSettings n -> TimeInterval Source
tsRun :: TimerSettings n -> n () -> IO () Source
tsAction :: TimerSettings n -> n () Source
Timer type
Creating and destroying timers
newTimer :: (MonadIO m, MonadIO n, MonadCatch n) => TimerSettings n -> m (Timer n) Source
releaseTimer :: MonadIO m => Timer n -> m () Source
withTimer :: (MonadIO m, MonadMask m, MonadIO n, MonadCatch n) => TimerSettings n -> (Timer n -> m a) -> m a Source
Starting a timer
startTimer :: MonadIO m => Timer n -> m () Source
startTimer' :: (TimeUnit t, MonadIO m) => Timer n -> t -> m () Source
Stopping a timer
Restarting a timer
restartTimer :: MonadIO m => Timer n -> m () Source
restartTimer' :: (TimeUnit t, MonadIO m) => Timer n -> t -> m () Source