broadcast-chan 0.2.0.1 → 0.2.0.2
raw patch · 5 files changed
+54/−14 lines, 5 filesdep ~basePVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ BroadcastChan.Prelude: forM_ :: MonadIO m => BroadcastChan Out a -> (a -> m b) -> m ()
+ BroadcastChan.Prelude: mapM_ :: MonadIO m => (a -> m b) -> BroadcastChan Out a -> m ()
Files
- BroadcastChan/Extra.hs +7/−7
- BroadcastChan/Internal.hs +3/−3
- BroadcastChan/Prelude.hs +35/−0
- CHANGELOG.md +4/−0
- broadcast-chan.cabal +5/−4
BroadcastChan/Extra.hs view
@@ -199,9 +199,9 @@ -- See "BroadcastChan" or @broadcast-chan-conduit@ for examples. -- -- The returned 'BracketOnError' has a 'allocate' action that takes care of--- setting up 'forkIO' threads and exception handlers. The 'cleanup' action--- ensures all threads are terminate in case of an exception. Finally, 'action'--- performs the actual parallel processing of elements.+-- setting up 'Control.Concurrent.forkIO' threads and exception handlers. The+-- 'cleanup' action ensures all threads are terminate in case of an exception.+-- Finally, 'action' performs the actual parallel processing of elements. runParallel :: forall a b m n r . (MonadIO m, MonadIO n)@@ -231,7 +231,7 @@ let queueAndYield :: a -> m (Maybe b) queueAndYield x = do- Just v <- liftIO $ readBChan outChanOut <* bufferValue x+ ~(Just v) <- liftIO $ readBChan outChanOut <* bufferValue x return v finish :: r -> n r@@ -266,9 +266,9 @@ -- @broadcast-chan-conduit@ for examples. -- -- The returned 'BracketOnError' has a 'allocate' action that takes care of--- setting up 'forkIO' threads and exception handlers. The 'cleanup' action--- ensures all threads are terminate in case of an exception. Finally, 'action'--- performs the actual parallel processing of elements.+-- setting up 'Control.Concurrent.forkIO' threads and exception handlers. Th+-- 'cleanup' action ensures all threads are terminate in case of an exception.+-- Finally, 'action' performs the actual parallel processing of elements. runParallel_ :: (MonadIO m, MonadIO n) => Handler IO a
BroadcastChan/Internal.hs view
@@ -173,7 +173,7 @@ xs <- go ch return (x:xs) --- | Strict fold of the 'BroadcastChan''s messages. Can be used with+-- | Strict fold of the 'BroadcastChan''s messages. Can be used with -- "Control.Foldl" from Tekmo's foldl package: -- -- @"Control.Foldl".'Control.Foldl.purely' 'foldBChan' :: ('MonadIO' m, 'MonadIO' n) => 'Control.Foldl.Fold' a b -> 'BroadcastChan' d a -> n (m b)@@@ -214,10 +214,10 @@ Nothing -> return $! done x {-# INLINABLE foldBChan #-} --- | Strict, monadic fold of the 'BroadcastChan''s messages. Can be used with+-- | Strict, monadic fold of the 'BroadcastChan''s messages. Can be used with -- "Control.Foldl" from Tekmo's foldl package: ----- @"Control.Foldl".'Control.Foldl.impurely' 'foldBChanM' :: ('MonadIO' m, 'MonadIO' n) => 'FoldM' m a b -> 'BroadcastChan' d a -> n (m b)@+-- @"Control.Foldl".'Control.Foldl.impurely' 'foldBChanM' :: ('MonadIO' m, 'MonadIO' n) => 'Control.Foldl.FoldM' m a b -> 'BroadcastChan' d a -> n (m b)@ -- -- Has the same behaviour and guarantees as 'foldBChan'. foldBChanM
+ BroadcastChan/Prelude.hs view
@@ -0,0 +1,35 @@+{-# LANGUAGE Safe #-}+-------------------------------------------------------------------------------+-- |+-- Module : BroadcastChan.Prelude+-- Copyright : (C) 2014-2018 Merijn Verstraaten+-- License : BSD-style (see the file LICENSE)+-- Maintainer : Merijn Verstraaten <merijn@inconsistent.nl>+-- Stability : experimental+-- Portability : haha+--+-- This module contains convenience functions that clash with names in+-- "Prelude" and is intended to be imported qualified.+-------------------------------------------------------------------------------+module BroadcastChan.Prelude+ ( forM_+ , mapM_+ ) where++import Prelude hiding (mapM_)+import Control.Monad.IO.Unlift (MonadIO(..))++import BroadcastChan++-- | 'mapM_' with it's arguments flipped.+forM_ :: MonadIO m => BroadcastChan Out a -> (a -> m b) -> m ()+forM_ = flip mapM_++-- | Map a monadic function over the elements of a 'BroadcastChan', ignoring+-- the results.+mapM_ :: MonadIO m => (a -> m b) -> BroadcastChan Out a -> m ()+mapM_ f ch = do+ result <- liftIO $ readBChan ch+ case result of+ Nothing -> return ()+ Just x -> f x >> mapM_ f ch
CHANGELOG.md view
@@ -1,3 +1,7 @@+0.2.0.2 [2019.03.30]+--------------------+* GHC 8.6/MonadFail compatibility fix+ 0.2.0.1 [2018.09.24] -------------------- * Loosen STM bounds for new stackage release.
broadcast-chan.cabal view
@@ -1,12 +1,12 @@ Name: broadcast-chan-Version: 0.2.0.1+Version: 0.2.0.2 Homepage: https://github.com/merijn/broadcast-chan Bug-Reports: https://github.com/merijn/broadcast-chan/issues Author: Merijn Verstraaten Maintainer: Merijn Verstraaten <merijn@inconsistent.nl>-Copyright: Copyright © 2014-2018 Merijn Verstraaten+Copyright: Copyright © 2014-2019 Merijn Verstraaten License: BSD3 License-File: LICENSE@@ -15,7 +15,7 @@ Cabal-Version: >= 1.10 Build-Type: Simple Tested-With: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2,- GHC == 8.4.3, GHC == 8.6.1+ GHC == 8.4.4, GHC == 8.6.4 Extra-Source-Files: README.md , CHANGELOG.md@@ -87,6 +87,7 @@ Exposed-Modules: BroadcastChan BroadcastChan.Extra+ BroadcastChan.Prelude BroadcastChan.Throw Other-Modules: BroadcastChan.Internal @@ -100,7 +101,7 @@ Trustworthy TupleSections - Build-Depends: base >= 4.7 && < 5+ Build-Depends: base >= 4.7 && < 4.13 , unliftio-core >= 0.1.1 && < 0.2 Benchmark sync