lifted-threads-1.0: lifted IO operations from the threads library

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Concurrent.Thread.Lifted

Contents

Description

This is a wrapped version of Control.Concurrent.Thread with types generalised from IO to all monads in either MonadBase or MonadBaseControl.

Synopsis

Forking threads

fork :: MonadBaseControl IO m => m a -> m (ThreadId, m (Result a)) Source

Generalized version of forkIO.

forkOS :: MonadBaseControl IO m => m a -> m (ThreadId, m (Result a)) Source

Generalized version of forkOS.

forkOn :: MonadBaseControl IO m => Int -> m a -> m (ThreadId, m (Result a)) Source

Generalized version of forkOn.

forkWithUnmask :: MonadBaseControl IO m => ((forall b. m b -> m b) -> m a) -> m (ThreadId, m (Result a)) Source

Generalized version of forkIOWithUnmask.

forkOnWithUnmask :: MonadBaseControl IO m => Int -> ((forall b. m b -> m b) -> m a) -> m (ThreadId, m (Result a)) Source

Generalized version of forkOnWithUnmask.

Results

type Result a = Either SomeException a

A result of a thread is either some exception that was thrown in the thread and wasn't catched or the actual value that was returned by the thread.

result :: MonadBase IO m => Result a -> m a Source