Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- data TimeoutT m a
- runTimeoutT :: (TimeUnit t, MonadIO m, MonadMask m) => TimeoutT m a -> t -> m a
- withTimeoutThrow :: (MonadIO m, MonadCatch m) => m a -> TimeoutT m a
- withTimeoutThrow' :: (TimeUnit t, MonadIO m, MonadCatch m) => t -> m a -> TimeoutT m a
- withTimeoutCatch :: (MonadIO m, MonadCatch m) => m a -> TimeoutT m (Maybe a)
- withTimeoutCatch' :: (TimeUnit t, MonadCatch m, MonadIO m) => t -> m a -> TimeoutT m (Maybe a)
Documentation
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.
MonadTrans TimeoutT Source | |
Monad m => Monad (TimeoutT m) Source | |
Functor m => Functor (TimeoutT m) Source | |
MonadFix m => MonadFix (TimeoutT m) Source | |
Applicative m => Applicative (TimeoutT m) Source | |
MonadThrow m => MonadThrow (TimeoutT m) Source | |
MonadCatch m => MonadCatch (TimeoutT m) Source | |
MonadMask m => MonadMask (TimeoutT m) Source | |
MonadIO m => MonadIO (TimeoutT m) Source | |
(MonadIO m, MonadCatch m) => MonadTimeout (TimeoutT m) m Source |
withTimeoutThrow :: (MonadIO m, MonadCatch m) => m a -> TimeoutT m a Source
withTimeoutThrow' :: (TimeUnit t, MonadIO m, MonadCatch m) => t -> m a -> TimeoutT m a Source
withTimeoutCatch :: (MonadIO m, MonadCatch m) => m a -> TimeoutT m (Maybe a) Source
withTimeoutCatch' :: (TimeUnit t, MonadCatch m, MonadIO m) => t -> m a -> TimeoutT m (Maybe a) Source