Community
Modules 4

Control.Concurrent.Stream

Processing streams with a fixed number of worker threads

stream :: Int -> ((a -> IO ()) -> IO ()) -> (a -> IO ()) -> 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.

Int

Maximum Concurrency

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

Producer

(a -> IO ())

Worker

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

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

Int

Maximum Concurrency

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

Producer

(a -> IO ())

Worker

streamWithInput :: ((a -> IO ()) -> IO ()) -> [b] -> (b -> a -> IO ()) -> IO ()

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

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

Producer

[b]

Worker state

(b -> a -> IO ())

Worker

streamWithOutput :: Int -> ((a -> IO ()) -> IO ()) -> (a -> IO c) -> IO [c]

Like stream, but collects the results of each worker

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

Producer

(a -> IO c)

Worker

streamWithInputOutput :: ((a -> IO ()) -> IO ()) -> [b] -> (b -> a -> IO c) -> IO [c]

Like streamWithInput, but collects the results of each worker

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

Producer

[b]

Worker input

(b -> a -> IO c)

Worker

mapConcurrentlyBounded :: Int -> (a -> IO b) -> [a] -> IO [b]

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

List of output values

Int

Maximum concurrency

(a -> IO b)

Function to map over the input values

[a]

List of input values

forConcurrentlyBounded :: Int -> [a] -> (a -> IO b) -> IO [b]

mapConcurrentlyBounded but with its arguments reversed

List of output values

Int

Maximum concurrency

[a]

List of input values

(a -> IO b)

Function to map over the input values

Build record and source files

Community contribution. The service has not verified this documentation.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-aa6debbd-web-3

Metadata snapshot: 19a17fec6f51aec017fc45abde955c1e4fb18fa220fb1acb9d601743c725a768

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.