cio-0.1.0: A monad for concurrent IO on a thread pool

Safe HaskellNone

CIO

Synopsis

Documentation

data CIO r Source

Concurrent IO. A composable monad of IO actions executable in a shared pool of threads.

runCIO :: Int -> CIO r -> IO rSource

Run with a pool of the specified size.

runCIO' :: CIO r -> IO rSource

Run with a pool the size of the amount of available processors.

class Monad m => MonadCIO m whereSource

Methods

getPoolNumCapabilities :: m IntSource

Get the maximum number of available threads, which is set in runCIO.

sequenceConcurrently :: [m a] -> m [a]Source

Same as Control.Monad.sequence, but performs concurrently.

sequenceConcurrently' :: [m a] -> m [a]Source

Same as sequenceConcurrently with a difference that it does not maintain the order of results, which allows it to execute a bit more efficiently.

sequenceConcurrently_ :: [m a] -> m ()Source

Same as Control.Monad.sequence_, but performs concurrently. Blocks the calling thread until all actions are finished.

Instances

mapMConcurrently :: MonadCIO m => (a -> m b) -> [a] -> m [b]Source

mapMConcurrently' :: MonadCIO m => (a -> m b) -> [a] -> m [b]Source

mapMConcurrently_ :: MonadCIO m => (a -> m b) -> [a] -> m ()Source

forMConcurrently :: MonadCIO m => [a] -> (a -> m b) -> m [b]Source

forMConcurrently' :: MonadCIO m => [a] -> (a -> m b) -> m [b]Source

forMConcurrently_ :: MonadCIO m => [a] -> (a -> m b) -> m ()Source

distributeConcurrently :: MonadCIO m => m a -> m [a]Source

Run the provided side-effecting action on all available threads and collect the results. The order of results may vary from run to run.

distributeConcurrently_ :: MonadCIO m => m a -> m ()Source

Run the provided side-effecting action on all available threads.