simple-pipe 0.0.0.25 → 0.0.0.26
raw patch · 2 files changed
+13/−3 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Data.Pipe.TChan: toTChansM :: (PipeClass p, MonadBase IO m, MonadTrans (p (a, b) x), Monad (p (a, b) x m)) => m [(a -> Bool, TChan b)] -> p (a, b) x m ()
Files
- simple-pipe.cabal +2/−2
- src/Data/Pipe/TChan.hs +11/−1
simple-pipe.cabal view
@@ -2,7 +2,7 @@ cabal-version: >= 1.8 name: simple-pipe-version: 0.0.0.25+version: 0.0.0.26 stability: Experimental author: Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer: Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -80,7 +80,7 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/simple-pipe.git- tag: simple-pipe-0.0.0.25+ tag: simple-pipe-0.0.0.26 library hs-source-dirs: src
src/Data/Pipe/TChan.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE TupleSections, FlexibleContexts, PackageImports #-} -module Data.Pipe.TChan (fromTChan, toTChan, fromTChans, toTChans) where+module Data.Pipe.TChan (+ fromTChan, toTChan, fromTChans, toTChans, toTChansM) where import Control.Applicative import Control.Arrow@@ -39,6 +40,15 @@ MonadTrans (p (a, b) x), Monad (p (a, b) x m)) => [(a -> Bool, TChan b)] -> p (a, b) x m () toTChans cs = (await >>=) . maybe (return ()) $ \(t, x) -> (>> toTChans cs) $+ case find (($ t) . fst) cs of+ Just (_, c)-> lift . liftBase . atomically $ writeTChan c x+ _ -> return ()++toTChansM :: (PipeClass p, MonadBase IO m,+ MonadTrans (p (a, b) x), Monad (p (a, b) x m)) =>+ m [(a -> Bool, TChan b)] -> p (a, b) x m ()+toTChansM mcs = (await >>=) . maybe (return ()) $ \(t, x) -> (>> toTChansM mcs) $ do+ cs <- lift mcs case find (($ t) . fst) cs of Just (_, c)-> lift . liftBase . atomically $ writeTChan c x _ -> return ()