io-classes
Safe HaskellNone
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 :: Type -> Type) where Source #

Associated Types

type ThreadId (m :: Type -> Type) Source #

Methods

myThreadId :: m (ThreadId m) Source #

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

threadLabel :: ThreadId m -> m (Maybe String) Source #

Requires ghc-9.6.1 or newer.

Since: 1.8.0.0

Instances

Instances details
MonadThread IO Source # 
Instance details

Defined in Control.Monad.Class.MonadFork

Associated Types

type ThreadId IO 
Instance details

Defined in Control.Monad.Class.MonadFork

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

Defined in Control.Monad.Class.MonadFork

Associated Types

type ThreadId (ReaderT r m) 
Instance details

Defined in Control.Monad.Class.MonadFork

type ThreadId (ReaderT r m) = ThreadId m

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

Apply the label to the current thread

class MonadThread m => MonadFork (m :: Type -> Type) 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 #