conceit-0.2.0.0: Concurrent actions that may fail

Safe HaskellSafe-Inferred

Control.Concurrent.Conceit

Synopsis

Documentation

newtype Conceit e a Source

Conceit is very similar to Concurrently from the async package, but it has an explicit error type e.

The Applicative instance runs two actions concurrently, waits until they finish, and combines their results.

However, if any of the actions fails with e the other action is immediately cancelled and the whole computation fails with e.

To put it another way: Conceit behaves like Concurrently for successes and like race for errors.

Constructors

Conceit 

Fields

runConceit :: IO (Either e a)
 

Instances

Bifunctor Conceit 
MonadError e (Conceit e) 
Monad (Conceit e)

>> is concurrent.

Functor (Conceit e) 
MonadPlus (Conceit e) 
Applicative (Conceit e) 
MonadThrow (Conceit e)

Throws exceptions into IO.

MonadCatch (Conceit e)

Catches exceptions from IO.

MonadIO (Conceit e) 
Alternative (Conceit e) 
Plus (Conceit e)

zero is a computation that never finishes.

Alt (Conceit e)

<!> makes its two arguments race against each other.

Apply (Conceit s)

<.> is concurrent.

Bind (Conceit s)

>>- is sequential.

Monoid a => Monoid (Conceit e a) 

_Conceit :: IO a -> Conceit e aSource

conceit :: IO (Either e a) -> IO (Either e b) -> IO (Either e (a, b))Source

mapConceit :: Traversable t => (a -> IO (Either e b)) -> t a -> IO (Either e (t b))Source

Works similarly to mapConcurrently from the async package, but if any of the computations fails with e, the others are immediately cancelled and the whole computation fails with e.