io-classes-1.4.1.0: Type classes for concurrency with STM, ST and timing
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Class.MonadTimer

Description

Provides classes to handle delays and timeouts which generalised base API to both IO and IOSim.

Synopsis

Documentation

class Monad m => MonadDelay m where Source #

A typeclass to delay current thread.

Methods

threadDelay :: Int -> m () Source #

Suspends the current thread for a given number of microseconds (GHC only).

See threadDelay.

Instances

Instances details
MonadDelay IO Source # 
Instance details

Defined in Control.Monad.Class.MonadTimer

Methods

threadDelay :: Int -> IO () Source #

MonadDelay m => MonadDelay (ReaderT r m) Source # 
Instance details

Defined in Control.Monad.Class.MonadTimer

Methods

threadDelay :: Int -> ReaderT r m () Source #

class (MonadDelay m, MonadSTM m) => MonadTimer m where Source #

A typeclass providing utilities for timeouts.

Methods

registerDelay :: Int -> m (TVar m Bool) Source #

timeout :: Int -> m a -> m (Maybe a) Source #

See timeout.

Instances

Instances details
MonadTimer IO Source # 
Instance details

Defined in Control.Monad.Class.MonadTimer

Methods

registerDelay :: Int -> IO (TVar IO Bool) Source #

timeout :: Int -> IO a -> IO (Maybe a) Source #

MonadTimer m => MonadTimer (ReaderT r m) Source # 
Instance details

Defined in Control.Monad.Class.MonadTimer

Methods

registerDelay :: Int -> ReaderT r m (TVar (ReaderT r m) Bool) Source #

timeout :: Int -> ReaderT r m a -> ReaderT r m (Maybe a) Source #