time-out-0.2: Timers, timeouts, alarms, monadic wrappers

Safe HaskellNone
LanguageHaskell2010

Control.Timer

Contents

Description

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.

Synopsis

Settings

tsRun :: TimerSettings n -> n () -> IO () Source

Timer type

data Timer n Source

Creating and destroying timers

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

startTimerWith :: (TimeUnit t, MonadIO m) => Timer n -> Maybe t -> Maybe (n ()) -> m () Source

Stopping a timer

stopTimer :: MonadIO m => Timer n -> m () Source

Restarting a timer

restartTimer :: MonadIO m => Timer n -> m () Source

restartTimer' :: (TimeUnit t, MonadIO m) => Timer n -> t -> m () Source

restartTimerWith :: (TimeUnit t, MonadIO m) => Timer n -> Maybe t -> Maybe (n ()) -> m () Source