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

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Trans.Timeout

Description

Monad transformer for running actions with a time limit. Provides a scalable MonadTimeout instance (at least for the case of a constant number of long-running threads). If you need to use timeouts often in a computation, this is probably better than Control.Timeout.

Synopsis

Documentation

data TimeoutT m a Source

Monad transformer which gives your monad stack an ability to run actions with a timeout, and abort them if they don't finish within the time limit.

By default, e.g. if you lift or liftIO an action, it runs in the regular way without a timeout. Use one of the timeout functions, such as withTimeoutThrow, to use the timeout.

runTimeoutT :: (TimeUnit t, MonadIO m, MonadMask m) => TimeoutT m a -> t -> m a Source