async-2.2.6: Run IO operations asynchronously and wait for their results
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Concurrent.Stream

Description

Processing streams with a fixed number of worker threads

Synopsis

Documentation

stream Source #

Arguments

:: Int

Maximum Concurrency

-> ((a -> IO ()) -> IO ())

Producer

-> (a -> IO ())

Worker

-> IO () 

Maps a fixed number of workers concurrently over a stream of values produced by a producer function. The producer is passed a function to call for each work item. If a worker throws a synchronous exception, it will be propagated to the caller.

streamBound Source #

Arguments

:: Int

Maximum Concurrency

-> ((a -> IO ()) -> IO ())

Producer

-> (a -> IO ())

Worker

-> IO () 

Like stream, but uses bound threads for the workers. See forkOS for details on bound threads.

streamWithInput Source #

Arguments

:: ((a -> IO ()) -> IO ())

Producer

-> [b]

Worker state

-> (b -> a -> IO ())

Worker

-> IO () 

Like stream, but each worker is passed an element of an input list.

streamWithOutput Source #

Arguments

:: Int 
-> ((a -> IO ()) -> IO ())

Producer

-> (a -> IO c)

Worker

-> IO [c] 

Like stream, but collects the results of each worker

streamWithInputOutput Source #

Arguments

:: ((a -> IO ()) -> IO ())

Producer

-> [b]

Worker input

-> (b -> a -> IO c)

Worker

-> IO [c] 

Like streamWithInput, but collects the results of each worker

mapConcurrentlyBounded Source #

Arguments

:: Int

Maximum concurrency

-> (a -> IO b)

Function to map over the input values

-> [a]

List of input values

-> IO [b]

List of output values

Concurrent map over a list of values, using a bounded number of threads.

forConcurrentlyBounded Source #

Arguments

:: Int

Maximum concurrency

-> [a]

List of input values

-> (a -> IO b)

Function to map over the input values

-> IO [b]

List of output values

mapConcurrentlyBounded but with its arguments reversed