packages feed

simple-pipe 0.0.0.22 → 0.0.0.23

raw patch · 2 files changed

+14/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

simple-pipe.cabal view
@@ -2,7 +2,7 @@ cabal-version:	>= 1.8  name:		simple-pipe-version:	0.0.0.22+version:	0.0.0.23 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.22+    tag:	simple-pipe-0.0.0.23  library     hs-source-dirs:	src@@ -92,3 +92,4 @@         monads-tf == 0.1.*, bytestring == 0.10.*, transformers-base == 0.4.*,         stm == 2.4.*     ghc-options:	-Wall+    extensions:		DoAndIfThenElse
src/Data/Pipe/TChan.hs view
@@ -1,8 +1,9 @@-{-# LANGUAGE FlexibleContexts, PackageImports #-}+{-# LANGUAGE TupleSections, FlexibleContexts, PackageImports #-}  module Data.Pipe.TChan (fromTChan, toTChan, fromTChans, toTChans) where  import Control.Applicative+import Control.Arrow import "monads-tf" Control.Monad.Trans import Control.Monad.Base import Control.Concurrent.STM@@ -15,14 +16,19 @@  fromTChans :: (PipeClass p, MonadBase IO m, 	MonadTrans (p x a), Monad (p x a m)) => [TChan a] -> p x a m ()-fromTChans cs = (>> fromTChans cs) . (yield =<<) . lift . liftBase . atomically $ do-	readTChans cs >>= maybe retry return+fromTChans cs = do+	(cs', x) <- lift . liftBase . atomically $ do+		readTChans cs >>= maybe retry return+	yield x+	fromTChans $ uncurry (flip (++)) cs' -readTChans :: [TChan a] -> STM (Maybe a)+readTChans :: [TChan a] -> STM (Maybe (([TChan a], [TChan a]), a)) readTChans [] = return Nothing readTChans (c : cs) = do 	e <- isEmptyTChan c-	if e then readTChans cs else Just <$> readTChan c+	if e+	then (first (first (c :)) <$>) <$>  readTChans cs+	else Just . (([c], cs) ,) <$> readTChan c  toTChan :: (PipeClass p, MonadBase IO m, 	MonadTrans (p a x), Monad (p a x m)) => TChan a -> p a x m ()