newtype TaskId { } #
TaskId Word64
Task identifier.
data TaskStatus { } #
TaskPending

Not yet started

TaskRunning

Currently executing

TaskCompleted

Finished successfully

TaskCancelled

Was cancelled

TaskFailed

Threw an exception

Status of a task.
data CancelledException { } #
CancelledException
Exception thrown when task is cancelled.
data DeadlineExceeded { } #
DeadlineExceeded
Exception for deadline exceeded.
type Strategy a = a -> Eval a { } #
class Cancellable a { } #

Methods

requestCancel :: a -> IO ()
wasCancelled :: a -> IO Bool
Types that can be cancelled.
class NFData a { } #

Methods

rnf :: a -> ()
Class for deep evaluation.
class Exception e { } #
withScope :: (Scope -> IO a) -> IO a { } #
withScopeNamed :: String -> (Scope -> IO a) -> IO a { } #
Run action within a named scope (for debugging).
cancelScope :: Scope -> IO () { } #
Cancel all tasks in scope.
scopeName :: Scope -> Maybe String { } #
Get scope name (if any).
spawn :: Scope -> (IO a) -> IO (Task a) { } #
spawnNamed :: String -> Scope -> (IO a) -> IO (Task a) { } #
Spawn a named task.
await :: (Task a) -> IO a { } #
Wait for task completion.
awaitAll :: [Task a] -> IO [a] { } #
Wait for all tasks.
poll :: (Task a) -> IO (Maybe (Either SomeException a)) { } #
Check if task completed (non-blocking).
cancel :: (Task a) -> IO () { } #
Cancel a task.
taskId :: (Task a) -> TaskId { } #
Get task identifier.
taskStatus :: (Task a) -> IO TaskStatus { } #
Get current task status.
isRunning :: TaskStatus -> Bool { } #
Check if task is running.
isCompleted :: TaskStatus -> Bool { } #
Check if task completed successfully.
isCancelled :: TaskStatus -> Bool { } #
Check if task was cancelled.
isFailed :: TaskStatus -> Bool { } #
Check if task failed with exception.
checkCancelled :: IO () { } #
Check if current task is cancelled.
withCancellation :: (IO a) -> IO a { } #
Run action with cancellation support.
onCancel :: (IO a) -> (IO ()) -> IO a { } #
Register cleanup handler for cancellation.
isCancelledException :: SomeException -> Bool { } #
Check if exception is cancellation.
withDeadline :: Duration -> (IO a) -> IO (Maybe a) { } #
Run action with deadline.
withTimeout :: Duration -> (IO a) -> IO a { } #
Run action with timeout.
getDeadline :: IO (Maybe Deadline) { } #
remainingTime :: Deadline -> IO Duration { } #
Time remaining until deadline.
async :: (IO a) -> IO (Task a) { } #
Spawn async computation.
asyncNamed :: String -> (IO a) -> IO (Task a) { } #
Spawn named async computation.
wait :: (Task a) -> IO a { } #
Wait for async result.
waitCatch :: (Task a) -> IO (Either SomeException a) { } #
Wait for async result, catching exceptions.
waitAny :: [Task a] -> IO (Task a, a) { } #
Wait for any task to complete.
waitAll :: [Task a] -> IO [a] { } #
Wait for all tasks to complete.
waitEither :: (Task a) -> (Task b) -> IO (Either a b) { } #
Wait for either task to complete.
race :: (IO a) -> (IO b) -> IO (Either a b) { } #
Race two actions, cancel loser.
race_ :: (IO a) -> (IO b) -> IO () { } #
Race two actions, discard result.
concurrently :: (IO a) -> (IO b) -> IO (a, b) { } #
Run two actions concurrently.
concurrently_ :: (IO a) -> (IO b) -> IO () { } #
Run two actions concurrently, discard results.
mapConcurrently :: (a -> IO b) -> [a] -> IO [b] { } #
Map function over list concurrently.
mapConcurrently_ :: (a -> IO b) -> [a] -> IO () { } #
Map function over list concurrently, discard results.
forConcurrently :: [a] -> (a -> IO b) -> IO [b] { } #
Flipped mapConcurrently.
forConcurrently_ :: [a] -> (a -> IO b) -> IO () { } #
Flipped mapConcurrently_.
replicateConcurrently :: Int -> (IO a) -> IO [a] { } #
Replicate action concurrently.
replicateConcurrently_ :: Int -> (IO a) -> IO () { } #
Replicate action concurrently, discard results.
newChan :: IO (Chan a) { } #
readChan :: (Chan a) -> IO a { } #
Read from channel (blocks if empty).
writeChan :: (Chan a) -> a -> IO () { } #
Write to channel.
tryReadChan :: (Chan a) -> IO (Maybe a) { } #
Try to read (non-blocking).
tryWriteChan :: (Chan a) -> a -> IO Bool { } #
Try to write (non-blocking).
isEmptyChan :: (Chan a) -> IO Bool { } #
Check if channel is empty.
dupChan :: (Chan a) -> IO (Chan a) { } #
Duplicate channel (new read end).
newBoundedChan :: Int -> IO (BoundedChan a) { } #
readBoundedChan :: (BoundedChan a) -> IO a { } #
Read from bounded channel.
writeBoundedChan :: (BoundedChan a) -> a -> IO () { } #
Write to bounded channel (blocks if full).
tryReadBoundedChan :: (BoundedChan a) -> IO (Maybe a) { } #
Try to read from bounded channel.
tryWriteBoundedChan :: (BoundedChan a) -> a -> IO Bool { } #
Try to write to bounded channel.
isFull :: (BoundedChan a) -> IO Bool { } #
Check if channel is at capacity.
capacity :: (BoundedChan a) -> Int { } #
Get channel capacity.
newMVar :: a -> IO (MVar a) { } #
newEmptyMVar :: IO (MVar a) { } #
Create empty MVar.
takeMVar :: (MVar a) -> IO a { } #
Take value from MVar (blocks if empty).
putMVar :: (MVar a) -> a -> IO () { } #
Put value into MVar (blocks if full).
readMVar :: (MVar a) -> IO a { } #
Read MVar without taking.
tryTakeMVar :: (MVar a) -> IO (Maybe a) { } #
Try to take (non-blocking).
tryPutMVar :: (MVar a) -> a -> IO Bool { } #
Try to put (non-blocking).
tryReadMVar :: (MVar a) -> IO (Maybe a) { } #
Try to read (non-blocking).
isEmptyMVar :: (MVar a) -> IO Bool { } #
Check if MVar is empty.
modifyMVar :: (MVar a) -> (a -> IO (a, b)) -> IO b { } #
Modify MVar contents atomically.
modifyMVar_ :: (MVar a) -> (a -> IO a) -> IO () { } #
Modify MVar contents atomically (no result).
withMVar :: (MVar a) -> (a -> IO b) -> IO b { } #
Execute action with MVar value.
swapMVar :: (MVar a) -> a -> IO a { } #
Swap MVar contents.
newTVar :: a -> STM (TVar a) { } #
newTVarIO :: a -> IO (TVar a) { } #
Create TVar in IO.
readTVar :: (TVar a) -> STM a { } #
Read TVar in STM.
readTVarIO :: (TVar a) -> IO a { } #
Read TVar in IO.
writeTVar :: (TVar a) -> a -> STM () { } #
Write TVar in STM.
modifyTVar :: (TVar a) -> (a -> a) -> STM () { } #
Modify TVar.
modifyTVar' :: (TVar a) -> (a -> a) -> STM () { } #
Modify TVar strictly.
atomically :: (STM a) -> IO a { } #
retry :: STM a { } #
Retry transaction (block until TVars change).
orElse :: (STM a) -> (STM a) -> STM a { } #
Try first, then second if first retries.
check :: Bool -> STM () { } #
Retry if condition is false.
throwSTM :: (Exception e) => e -> STM a { } #
Throw exception in STM.
catchSTM :: (Exception e) => (STM a) -> (e -> STM a) -> STM a { } #
Catch exception in STM.
newSemaphore :: Int -> IO Semaphore { } #
acquireSemaphore :: Semaphore -> IO () { } #
Acquire permit (decrement, blocks if zero).
releaseSemaphore :: Semaphore -> IO () { } #
Release permit (increment).
tryAcquireSemaphore :: Semaphore -> IO Bool { } #
Try to acquire (non-blocking).
withSemaphore :: Semaphore -> (IO a) -> IO a { } #
Execute with acquired semaphore.
newMutex :: IO Mutex { } #
lock :: Mutex -> IO () { } #
Acquire mutex lock.
unlock :: Mutex -> IO () { } #
Release mutex lock.
tryLock :: Mutex -> IO Bool { } #
Try to acquire lock (non-blocking).
withMutex :: Mutex -> (IO a) -> IO a { } #
Execute with mutex locked.
newRWLock :: IO RWLock { } #
readLock :: RWLock -> IO () { } #
Acquire read lock.
readUnlock :: RWLock -> IO () { } #
Release read lock.
writeLock :: RWLock -> IO () { } #
Acquire write lock.
writeUnlock :: RWLock -> IO () { } #
Release write lock.
withReadLock :: RWLock -> (IO a) -> IO a { } #
Execute with read lock.
withWriteLock :: RWLock -> (IO a) -> IO a { } #
Execute with write lock.
newCondition :: IO Condition { } #
waitCondition :: Condition -> Mutex -> IO () { } #
Wait on condition (must hold associated mutex).
waitConditionFor :: Condition -> Mutex -> Duration -> IO Bool { } #
Wait on condition with timeout.
signal :: Condition -> IO () { } #
Signal one waiting thread.
broadcast :: Condition -> IO () { } #
Signal all waiting threads.
newBarrier :: Int -> IO Barrier { } #
waitBarrier :: Barrier -> IO () { } #
Wait at barrier.
newOnce :: IO Once { } #
runOnce :: Once -> (IO a) -> IO a { } #
Run action at most once.
newAtomicInt :: Int -> IO AtomicInt { } #
readAtomicInt :: AtomicInt -> IO Int { } #
Read atomic integer.
writeAtomicInt :: AtomicInt -> Int -> IO () { } #
Write atomic integer.
atomicAdd :: AtomicInt -> Int -> IO Int { } #
Atomic add, returns old value.
atomicSub :: AtomicInt -> Int -> IO Int { } #
Atomic subtract, returns old value.
atomicAnd :: AtomicInt -> Int -> IO Int { } #
Atomic bitwise and, returns old value.
atomicOr :: AtomicInt -> Int -> IO Int { } #
Atomic bitwise or, returns old value.
atomicXor :: AtomicInt -> Int -> IO Int { } #
Atomic bitwise xor, returns old value.
compareAndSwap :: AtomicInt -> Int -> Int -> IO Bool { } #
Compare and swap, returns success.
newAtomicRef :: a -> IO (AtomicRef a) { } #
readAtomicRef :: (AtomicRef a) -> IO a { } #
Read atomic reference.
writeAtomicRef :: (AtomicRef a) -> a -> IO () { } #
Write atomic reference.
atomicModifyRef :: (AtomicRef a) -> (a -> (a, b)) -> IO b { } #
Atomically modify reference.
atomicModifyRef' :: (AtomicRef a) -> (a -> (a, b)) -> IO b { } #
Atomically modify reference strictly.
casRef :: (AtomicRef a) -> a -> a -> IO Bool { } #
Compare and swap reference.
myThreadId :: IO ThreadId { } #
forkIO :: (IO ()) -> IO ThreadId { } #
Fork new thread.
forkOS :: (IO ()) -> IO ThreadId { } #
Fork bound thread.
forkOn :: Int -> (IO ()) -> IO ThreadId { } #
Fork on specific capability.
forkFinally :: (IO a) -> ((Either SomeException a) -> IO ()) -> IO ThreadId { } #
Fork with cleanup handler.
killThread :: ThreadId -> IO () { } #
Kill thread with async exception.
yield :: IO () { } #
Yield to scheduler.
threadDelay :: Int -> IO () { } #
Delay for microseconds.
threadCapability :: ThreadId -> IO (Int, Bool) { } #
Get thread's capability.
setNumCapabilities :: Int -> IO () { } #
Set number of capabilities.
getNumCapabilities :: IO Int { } #
Get number of capabilities.
getNumProcessors :: IO Int { } #
Get number of processors.
isCurrentThreadBound :: IO Bool { } #
Check if current thread is bound.
runInBoundThread :: (IO a) -> IO a { } #
Run in bound thread.
runInUnboundThread :: (IO a) -> IO a { } #
Run in unbound thread.
mask :: ((forall a. (IO a) -> IO a) -> IO b) -> IO b { } #
Mask async exceptions.
mask_ :: (IO a) -> IO a { } #
Mask async exceptions (no restore).
uninterruptibleMask :: ((forall a. (IO a) -> IO a) -> IO b) -> IO b { } #
Mask async exceptions uninterruptibly.
uninterruptibleMask_ :: (IO a) -> IO a { } #
Mask async exceptions uninterruptibly (no restore).
bracket :: (IO a) -> (a -> IO b) -> (a -> IO c) -> IO c { } #
Acquire/release pattern.
bracket_ :: (IO a) -> (IO b) -> (IO c) -> IO c { } #
Bracket without resource.
bracketOnError :: (IO a) -> (a -> IO b) -> (a -> IO c) -> IO c { } #
Bracket with cleanup only on error.
finally :: (IO a) -> (IO b) -> IO a { } #
Run action with cleanup.
onException :: (IO a) -> (IO b) -> IO a { } #
Run cleanup on exception.
par :: a -> b -> b { } #
Spark parallel evaluation.
pseq :: a -> b -> b { } #
Parallel sequence.
parMap :: (a -> b) -> [a] -> [b] { } #
Parallel map.
parList :: (Strategy a) -> Strategy [a] { } #
Parallel list evaluation.
parBuffer :: Int -> (Strategy a) -> Strategy [a] { } #
Parallel buffer.
parListChunk :: Int -> (Strategy a) -> Strategy [a] { } #
Parallel chunked list.
rseq :: Strategy a { } #
Evaluate to WHNF strategy.
rpar :: Strategy a { } #
Spark parallel evaluation strategy.
rdeepseq :: (NFData a) => Strategy a { } #
Evaluate to NF strategy.
using :: a -> (Strategy a) -> a { } #
Apply strategy to value.
withStrategy :: (Strategy a) -> a -> a { } #
Apply strategy in context.
runEval :: (Eval a) -> a { } #
Run evaluation.
instance Exception CancelledException { }
instance Exception DeadlineExceeded { }