chp-plus 1.3.0 → 1.3.1
raw patch · 3 files changed
+15/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Concurrent.CHP.Common: labelMe :: String -> a -> a
Files
Control/Concurrent/CHP/Buffers.hs view
@@ -86,8 +86,7 @@ = buff Seq.empty `onPoisonRethrow` (poison in_ >> poison out) where buff :: Seq a -> CHP ()- buff s | Seq.null s = takeIn >>= buff- | otherwise = (sendOut </> takeIn) >>= buff+ buff s = (sendOut </> takeIn) >>= buff where takeIn = liftM (addLast s) $ readChannel in_ sendOut = do writeChannel out (toList s)
Control/Concurrent/CHP/Common.hs view
@@ -54,11 +54,16 @@ import Control.Concurrent.CHP +-- Temporary:+--import Control.Concurrent.CHP.Traces (labelMe)+labelMe :: Prelude.String -> a -> a+labelMe _ x = x+ -- | Forever forwards the value onwards, unchanged. Adding this to your process -- network effectively adds a single-place buffer. id :: (ReadableChannel r, Poisonable (r a), WriteableChannel w, Poisonable (w a)) => r a -> w a -> CHP ()-id in_ out = (forever $+id in_ out = labelMe "Common.id" $ (forever $ do x <- readChannel in_ writeChannel out x ) `onPoisonRethrow` (poison in_ >> poison out)@@ -69,12 +74,13 @@ -- -- extId is a unit of the associative operator 'Control.Concurrent.CHP.Utils.|->|'. extId :: Chanin a -> Chanout a -> CHP ()-extId in_ out = do+extId in_ out = labelMe "Common.extId" $ do c <- oneToOneChannel- forever $+ forever ( extReadChannel in_ (writeChannel (writer c)) <&> extWriteChannel out (readChannel (reader c))+ ) `onPoisonRethrow` (poison in_ >> poison out) -- | A process that waits for an input, then sends it out on /all/ its output -- channels (in order) during an extended rendezvous. This is often used to send the@@ -93,7 +99,7 @@ -- | Sends out a single value first (the prefix) then behaves like id. prefix :: a -> Chanin a -> Chanout a -> CHP ()-prefix x in_ out = (writeChannel out x >> id in_ out)+prefix x in_ out = labelMe "Common.prefix" $ (writeChannel out x >> id in_ out) `onPoisonRethrow` (poison in_ >> poison out) -- | Discards the first value it receives then act likes id.@@ -103,12 +109,12 @@ -- | Forever reads in a value, and then sends out its successor (using 'Prelude.succ'). succ :: Enum a => Chanin a -> Chanout a -> CHP ()-succ = map Prelude.succ+succ = (labelMe "Common.succ" .) . map Prelude.succ -- | Reads in a value, and sends it out in parallel on all the given output -- channels. parDelta :: Chanin a -> [Chanout a] -> CHP ()-parDelta in_ outs = (forever $+parDelta in_ outs = labelMe "Common.parDelta" $ (forever $ do x <- readChannel in_ runParallel_ $ Prelude.map (Prelude.flip writeChannel x) outs ) `onPoisonRethrow` (poison in_ >> mapM_ poison outs)@@ -118,7 +124,7 @@ -- assume that this process will actually perform the computation. If you -- require a strict transformation, use 'map''. map :: (a -> b) -> Chanin a -> Chanout b -> CHP ()-map f in_ out = forever (readChannel in_ >>= writeChannel out . f)+map f in_ out = labelMe "Common.map" $ forever (readChannel in_ >>= writeChannel out . f) `onPoisonRethrow` (poison in_ >> poison out) -- | Like 'map', but applies the transformation strictly before sending on
chp-plus.cabal view
@@ -1,5 +1,5 @@ Name: chp-plus-Version: 1.3.0+Version: 1.3.1 Synopsis: A set of high-level concurrency utilities built on Communicating Haskell Processes License: BSD3 License-file: LICENSE