| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Control.Concurrent.Stream
Description
Processing streams with a fixed number of worker threads
Synopsis
- stream :: Int -> ((a -> IO ()) -> IO ()) -> (a -> IO ()) -> IO ()
- streamBound :: Int -> ((a -> IO ()) -> IO ()) -> (a -> IO ()) -> IO ()
- streamWithInput :: ((a -> IO ()) -> IO ()) -> [b] -> (b -> a -> IO ()) -> IO ()
- streamWithOutput :: Int -> ((a -> IO ()) -> IO ()) -> (a -> IO c) -> IO [c]
- streamWithInputOutput :: ((a -> IO ()) -> IO ()) -> [b] -> (b -> a -> IO c) -> IO [c]
- mapConcurrentlyBounded :: Int -> (a -> IO b) -> [a] -> IO [b]
- forConcurrentlyBounded :: Int -> [a] -> (a -> IO b) -> IO [b]
Documentation
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.
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.
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.
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