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

Control.Monad.Class.MonadFork

Description

A generalisation of Control.Concurrent API to both IO and IOSim.

Synopsis

Documentation

class (Monad m, Eq (ThreadId m), Ord (ThreadId m), Show (ThreadId m)) => MonadThread m where Source #

Associated Types

type ThreadId m :: Type Source #

Methods

myThreadId :: m (ThreadId m) Source #

labelThread :: ThreadId m -> String -> m () Source #

Instances

Instances details
MonadThread IO Source # 
Instance details

Defined in Control.Monad.Class.MonadFork

Associated Types

type ThreadId IO Source #

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

Defined in Control.Monad.Class.MonadFork

Associated Types

type ThreadId (ReaderT r m) Source #

labelThisThread :: MonadThread m => String -> m () Source #

Apply the label to the current thread

class MonadThread m => MonadFork m where Source #

Minimal complete definition

forkIO, forkOn, forkIOWithUnmask, forkFinally, throwTo, yield

Methods

forkIO :: m () -> m (ThreadId m) Source #

forkOn :: Int -> m () -> m (ThreadId m) Source #

forkIOWithUnmask :: ((forall a. m a -> m a) -> m ()) -> m (ThreadId m) Source #

forkFinally :: m a -> (Either SomeException a -> m ()) -> m (ThreadId m) Source #

throwTo :: Exception e => ThreadId m -> e -> m () Source #

killThread :: ThreadId m -> m () Source #

yield :: m () Source #

Instances

Instances details
MonadFork IO Source # 
Instance details

Defined in Control.Monad.Class.MonadFork

Methods

forkIO :: IO () -> IO (ThreadId IO) Source #

forkOn :: Int -> IO () -> IO (ThreadId IO) Source #

forkIOWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO (ThreadId IO) Source #

forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO (ThreadId IO) Source #

throwTo :: Exception e => ThreadId IO -> e -> IO () Source #

killThread :: ThreadId IO -> IO () Source #

yield :: IO () Source #

MonadFork m => MonadFork (ReaderT e m) Source # 
Instance details

Defined in Control.Monad.Class.MonadFork

Methods

forkIO :: ReaderT e m () -> ReaderT e m (ThreadId (ReaderT e m)) Source #

forkOn :: Int -> ReaderT e m () -> ReaderT e m (ThreadId (ReaderT e m)) Source #

forkIOWithUnmask :: ((forall a. ReaderT e m a -> ReaderT e m a) -> ReaderT e m ()) -> ReaderT e m (ThreadId (ReaderT e m)) Source #

forkFinally :: ReaderT e m a -> (Either SomeException a -> ReaderT e m ()) -> ReaderT e m (ThreadId (ReaderT e m)) Source #

throwTo :: Exception e0 => ThreadId (ReaderT e m) -> e0 -> ReaderT e m () Source #

killThread :: ThreadId (ReaderT e m) -> ReaderT e m () Source #

yield :: ReaderT e m () Source #