entwine-0.0.2: entwine - Concurrency tools

Safe HaskellNone
LanguageHaskell98

Entwine.Parallel

Synopsis

Documentation

data RunError a Source #

Instances
Show a => Show (RunError a) Source # 
Instance details

Defined in Entwine.Parallel

Methods

showsPrec :: Int -> RunError a -> ShowS #

show :: RunError a -> String #

showList :: [RunError a] -> ShowS #

consume_ :: MonadIO m => (Queue b -> IO a) -> Int -> (b -> EitherT e IO ()) -> EitherT (RunError e) m a Source #

Provide a producer and an action to be run across the result of that producer in parallel.

Common usage: @ let producer :: Address -> Queue Address -> IO () producer prefix q = list' prefix $$ writeQueue q

consume producer 100 ((a :: Address) -> doThis) @

consume :: forall a b c e. (Queue a -> IO b) -> Int -> (a -> IO (Either e c)) -> IO (Either (RunError e) (b, [c])) Source #

waitEitherBoth :: Async a -> Async b -> Async c -> IO (Either a (b, c)) Source #