conceit-0.5.0.0: Concurrent actions that may fail with a value.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Concurrent.Conceit

Contents

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

Instances

Instances details
Bifunctor Conceit Source # 
Instance details

Defined in Control.Concurrent.Conceit

Methods

bimap :: (a -> b) -> (c -> d) -> Conceit a c -> Conceit b d #

first :: (a -> b) -> Conceit a c -> Conceit b c #

second :: (b -> c) -> Conceit a b -> Conceit a c #

Functor (Conceit e) Source # 
Instance details

Defined in Control.Concurrent.Conceit

Methods

fmap :: (a -> b) -> Conceit e a -> Conceit e b #

(<$) :: a -> Conceit e b -> Conceit e a #

Applicative (Conceit e) Source # 
Instance details

Defined in Control.Concurrent.Conceit

Methods

pure :: a -> Conceit e a #

(<*>) :: Conceit e (a -> b) -> Conceit e a -> Conceit e b #

liftA2 :: (a -> b -> c) -> Conceit e a -> Conceit e b -> Conceit e c #

(*>) :: Conceit e a -> Conceit e b -> Conceit e b #

(<*) :: Conceit e a -> Conceit e b -> Conceit e a #

Alternative (Conceit e) Source #

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

Instance details

Defined in Control.Concurrent.Conceit

Methods

empty :: Conceit e a #

(<|>) :: Conceit e a -> Conceit e a -> Conceit e a #

some :: Conceit e a -> Conceit e [a] #

many :: Conceit e a -> Conceit e [a] #

Semigroup a => Semigroup (Conceit e a) Source # 
Instance details

Defined in Control.Concurrent.Conceit

Methods

(<>) :: Conceit e a -> Conceit e a -> Conceit e a #

sconcat :: NonEmpty (Conceit e a) -> Conceit e a #

stimes :: Integral b => b -> Conceit e a -> Conceit e a #

Monoid a => Monoid (Conceit e a) Source # 
Instance details

Defined in Control.Concurrent.Conceit

Methods

mempty :: Conceit e a #

mappend :: Conceit e a -> Conceit e a -> Conceit e a #

mconcat :: [Conceit e a] -> Conceit e a #

_Conceit :: IO a -> Conceit e a Source #

Construct a Conceit as if it were a Concurrently.

_runConceit :: Conceit Void a -> IO a Source #

Run a Conceit as if it were a Concurrently.

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.

Internals

conceit' :: IO a -> IO b -> (MVar (Either SomeException (Either a b)) -> IO r) -> IO r Source #

Verbatim copy of the internal concurrently' function from the async package.