Copyright | (C) 2014-2021 Merijn Verstraaten |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Merijn Verstraaten <merijn@inconsistent.nl> |
Stability | experimental |
Portability | haha |
Safe Haskell | Safe |
Language | Haskell2010 |
This module is identical to BroadcastChan, but replaces the parallel processing operations with functions for creating conduits and sinks that process in parallel.
Synopsis
- data Action
- data Handler (m :: Type -> Type) a
- = Simple Action
- | Handle (a -> SomeException -> m Action)
- parMapM :: (MonadResource m, MonadUnliftIO m) => Handler m a -> Int -> (a -> m b) -> ConduitM a b m ()
- parMapM_ :: (MonadResource m, MonadUnliftIO m) => Handler m a -> Int -> (a -> m ()) -> ConduitM a Void m ()
- data BroadcastChan (dir :: Direction) a
- data Direction
- type In = 'In
- type Out = 'Out
- newBroadcastChan :: MonadIO m => m (BroadcastChan In a)
- newBChanListener :: forall m (dir :: Direction) a. MonadIO m => BroadcastChan dir a -> m (BroadcastChan Out a)
- closeBChan :: MonadIO m => BroadcastChan In a -> m Bool
- isClosedBChan :: forall m (dir :: Direction) a. MonadIO m => BroadcastChan dir a -> m Bool
- getBChanContents :: forall (dir :: Direction) a. BroadcastChan dir a -> IO [a]
- foldBChan :: forall m n x a b (d :: Direction). (MonadIO m, MonadIO n) => (x -> a -> x) -> x -> (x -> b) -> BroadcastChan d a -> n (m b)
- foldBChanM :: forall m n x a b (d :: Direction). (MonadIO m, MonadIO n) => (x -> a -> m x) -> m x -> (x -> m b) -> BroadcastChan d a -> n (m b)
Documentation
:: (MonadResource m, MonadUnliftIO m) | |
=> Handler m a | Exception handler |
-> Int | Number of parallel threads to use |
-> (a -> m b) | Function to run in parallel |
-> ConduitM a b m () |
Create a conduit that processes inputs in parallel.
This function does NOT guarantee that input elements are processed or output in a deterministic order!
:: (MonadResource m, MonadUnliftIO m) | |
=> Handler m a | Exception handler |
-> Int | Number of parallel threads to use |
-> (a -> m ()) | Function to run in parallel |
-> ConduitM a Void m () |
Create a conduit sink that consumes inputs in parallel.
This function does NOT guarantee that input elements are processed or output in a deterministic order!
Re-exports from BroadcastChan
Datatypes
data BroadcastChan (dir :: Direction) a #
Instances
Eq (BroadcastChan dir a) | |
Defined in BroadcastChan.Internal (==) :: BroadcastChan dir a -> BroadcastChan dir a -> Bool # (/=) :: BroadcastChan dir a -> BroadcastChan dir a -> Bool # |
Construction
newBroadcastChan :: MonadIO m => m (BroadcastChan In a) #
newBChanListener :: forall m (dir :: Direction) a. MonadIO m => BroadcastChan dir a -> m (BroadcastChan Out a) #
Basic Operations
closeBChan :: MonadIO m => BroadcastChan In a -> m Bool #
isClosedBChan :: forall m (dir :: Direction) a. MonadIO m => BroadcastChan dir a -> m Bool #
getBChanContents :: forall (dir :: Direction) a. BroadcastChan dir a -> IO [a] #
Foldl combinators
Combinators for use with Tekmo's foldl
package.
foldBChan :: forall m n x a b (d :: Direction). (MonadIO m, MonadIO n) => (x -> a -> x) -> x -> (x -> b) -> BroadcastChan d a -> n (m b) #
foldBChanM :: forall m n x a b (d :: Direction). (MonadIO m, MonadIO n) => (x -> a -> m x) -> m x -> (x -> m b) -> BroadcastChan d a -> n (m b) #