Concurrential-0.2.1.0: Mix concurrent and sequential computation

Copyright(c) Alexander Vieth, 2015
LicenseBSD3
Maintaineraovieth@gmail.com
Stabilityexperimental
Portabilitynon-portable (GHC only)
Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.Concurrential.Safely

Description

 

Synopsis

Documentation

safely :: IO a -> ExceptT SomeException IO a Source

Make an arbitrary IO suitable for use with sequentially or concurrently so as to produce a term that can be run by runSafely:

let a = concurrently . safely $ dangerousComputation1 b = concurrently . safely $ dangerousComputation2 in runSafely $ a *> b

runSafely :: Concurrential (ExceptT SomeException IO) a -> IO (Either SomeException a) Source

Run a term such that computation is halted as soon as an exception is encountered, but any pending threads are waited on. The first exception to be thown (in term-order, not necessarily temporal order) is given as Left, and a Right is given if no exception is encountered.