spawn-0.2: Tiny library for joinable computations / threads with results.

Control.Concurrent.Spawn

Contents

Synopsis

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

type Result a = Either SomeException aSource

Two ways a computation of type IO a can end.

spawnTry :: IO a -> IO (IO (Result a))Source

Spawn a concurrent computation. Produces an action which demands a Result.

Limiting concurrency

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

Given n, produces a function to wrap IO actions. No more than n wrapped actions will be in progress at one time.