Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data RunError a
- renderRunError :: RunError a -> (a -> Text) -> Text
- consume :: MonadIO m => (Queue b -> IO a) -> Natural -> (b -> IO (Either e c)) -> m (Either (RunError e) (a, [c]))
- consume_ :: MonadIO m => (Queue b -> IO a) -> Natural -> (b -> EitherT e IO ()) -> EitherT (RunError e) m a
- waitEitherBoth :: Async a -> Async b -> Async c -> IO (Either a (b, c))
Types
Functions
consume :: MonadIO m => (Queue b -> IO a) -> Natural -> (b -> IO (Either e c)) -> m (Either (RunError e) (a, [c])) Source #
Provide a producer and an action to be run across the results
of that producer in parallel and collect the results.
For a version that ignores the results see consume_
.
Common usage:
let producer :: Address -> Queue Address -> IO Int producer prefix q = list' prefix $$ writeQueue q consume producer 100 ((a :: Address) -> doThis)
consume_ :: MonadIO m => (Queue b -> IO a) -> Natural -> (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.
For a version that doesn't ignore the results see consume
.
Common usage:
let producer :: Address -> Queue Address -> IO () producer prefix q = list' prefix $$ writeQueue q consume producer 100 ((a :: Address) -> doThis)