shellmate-0.2.3: Simple interface for shell scripting in Haskell.

Safe HaskellNone
LanguageHaskell98

Control.Shell.Concurrent

Description

Concurrency for Shellmate programs.

Synopsis

Documentation

data Future a Source

A future is a computation which is run in parallel with a program's main thread and which may at some later point finish and return a value.

Note that future computations are killed when their corresponding Future is garbage collected. This means that a future should *always* be awaited at some point or otherwise kept alive, to ensure that the computation finishes.

future :: Shell a -> Shell (Future a) Source

Create a future value.

await :: Future a -> Shell a Source

Wait for a future value.

check :: Future a -> Shell (Maybe a) Source

Check whether a future value has arrived or not.

parallel :: [Shell a] -> Shell [a] Source

Perform the given computations in parallel.

parallel_ :: [Shell a] -> Shell () Source

Like parallel, but discards any return values.

chunks :: Int -> [a] -> [[a]] Source

Break a list into chunks. This is quite useful for when performing *every* computation in parallel is too much. For instance, to download a list of files three at a time, one would do mapM_ (parallel_ downloadFile) (chunks 3 files).