| Copyright | (c) Alexander Vieth, 2015 |
|---|---|
| License | BSD3 |
| Maintainer | aovieth@gmail.com |
| Stability | experimental |
| Portability | non-portable (GHC only) |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.Concurrent.Concurrential.Safely
Description
- safely :: IO a -> ExceptT SomeException IO a
- runSafely :: Concurrential (ExceptT SomeException IO) a -> IO (Either SomeException a)
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.