Spawn
spawn :: IO a -> IO (IO a)Source
Spawn a concurrent computation. Produces an action which demands the result. Any exception from the original computation is re-thrown when and where the result is demanded.
Spawn with try
try
type Result a = Either SomeException aSource
Two ways a computation of type
can end.
IO
a
spawnTry :: IO a -> IO (IO (Result a))Source
Spawn a concurrent computation. Produces an action which
demands a
.
Result
Higher-level functions
parMapIO :: (a -> IO b) -> [a] -> IO [b]Source
Execute a separate thread of IO for each element of a list, and collect results.
The analogy to parMap
is misleading. The concurrent execution
of these actions is non-deterministic and can affect results.
However,
is expected to be most useful for actions
which do not interact.
parMapIO
parMapIO_ :: (a -> IO b) -> [a] -> IO ()Source
Execute a separate thread of IO for each element of a list.
Results are discarded, but the
action does not
complete until all threads have finished.
parMapIO_