packages feed

scc 0.8.2.1 → 0.8.2.2

raw patch · 4 files changed

+21/−20 lines, 4 files

Files

Control/Concurrent/SCC/Streams.hs view
@@ -82,7 +82,8 @@ import Data.Functor.Identity (Identity(..)) import Data.Functor.Sum (Sum(InR)) import Data.Monoid (Monoid(mappend, mconcat, mempty), First(First, getFirst))-import Data.Monoid.Factorial (FactorialMonoid, foldl, foldMap, mapM, mapM_, span, primePrefix, splitPrimePrefix)+import Data.Monoid.Factorial (FactorialMonoid)+import qualified Data.Monoid.Factorial as Factorial import Data.Monoid.Null (MonoidNull(null)) import Data.Maybe (mapMaybe) import Data.List (mapAccumL)@@ -218,7 +219,7 @@                   >>= \(FinalResult x) -> return x    where primeReader x = maybe (Deferred primeReader x)                                 (\(prefix, rest)-> Final rest prefix) -                               (splitPrimePrefix x)+                               (Factorial.splitPrimePrefix x)  -- | Invokes its first argument with the value it gets from the source, if there is any to get. getWith :: forall m a d x. (Monad m, FactorialMonoid x, AncestorFunctor a d) =>@@ -227,7 +228,7 @@                           >>= \(FinalResult x) -> x    where primeReader x = maybe (Deferred primeReader (return ()))                                (\(prefix, rest)-> Final rest (consumer prefix) )-                               (splitPrimePrefix x)+                               (Factorial.splitPrimePrefix x)  -- | Function 'peek' acts the same way as 'get', but doesn't actually consume the value from the source; sequential -- calls to 'peek' will always return the same value.@@ -266,7 +267,7 @@          readWhile predicate prefix1 s = if null suffix                                          then Deferred (readWhile predicate (prefix1 . mappend s)) (prefix1 s)                                          else Final suffix (prefix1 prefix2)-            where (prefix2, suffix) = span predicate s+            where (prefix2, suffix) = Factorial.span predicate s  -- | Consumes values from the /source/ until one of them satisfies the predicate or the source is emptied, then returns -- the pair of the list of preceding values and maybe the one value that satisfied the predicate. The latter is not@@ -278,8 +279,8 @@    where readUntil :: (x -> Bool) -> (x -> x) -> Reader x () (x, Maybe x)          readUntil predicate prefix1 s = if null suffix                                          then Deferred (readUntil predicate (prefix1 . mappend s)) (prefix1 s, Nothing)-                                         else Final suffix (prefix1 prefix2, Just $ primePrefix suffix)-            where (prefix2, suffix) = span predicate s+                                         else Final suffix (prefix1 prefix2, Just $ Factorial.primePrefix suffix)+            where (prefix2, suffix) = Factorial.span predicate s  -- | Copies all data from the /source/ argument into the /sink/ argument. The result indicates if there was any chunk to -- copy.@@ -320,7 +321,7 @@             where while s = if null suffix                             then Advance while prefix prefix                             else Final suffix prefix-                     where (prefix, suffix) = span p s+                     where (prefix, suffix) = Factorial.span p s  -- | Like 'pour', copies data from the /source/ to the /sink/, but only until one value satisfies the predicate. That -- value is returned rather than copied.@@ -331,8 +332,8 @@          readUntil p = until             where until s = if null suffix                             then Advance until (prefix, Nothing) prefix-                            else Final suffix (prefix, Just $ primePrefix suffix)-                     where (prefix, suffix) = span p s+                            else Final suffix (prefix, Just $ Factorial.primePrefix suffix)+                     where (prefix, suffix) = Factorial.span p s          loop rd = readChunk source rd >>= extract          extract (FinalResult (chunk, mx)) = putChunk sink chunk >> return mx          extract (ResultPart chunk rd') = putChunk sink chunk >> loop rd'@@ -343,7 +344,7 @@ mapStream f source sink = loop    where loop = readChunk source readAll                 >>= \r-> case r-                         of ResultPart chunk _ -> putChunk sink (foldMap f chunk) >> loop+                         of ResultPart chunk _ -> putChunk sink (Factorial.foldMap f chunk) >> loop                             FinalResult _ -> return ()  -- the last chunk must be empty  -- | An equivalent of 'Data.List.map' that works on a 'Sink' instead of a list. The argument function is applied to@@ -413,14 +414,14 @@ mapMStream f source sink = loop    where loop = readChunk source readAll                 >>= \r-> case r-                         of ResultPart chunk _ -> mapM f chunk >>= putChunk sink >> loop+                         of ResultPart chunk _ -> Factorial.mapM f chunk >>= putChunk sink >> loop                             FinalResult _ -> return ()  -- the last chunk must be empty  -- | 'mapMStream_' is similar to 'Control.Monad.mapM_' except it draws the values from a 'Source' instead of a list and -- works with 'Coroutine' instead of an arbitrary monad. mapMStream_ :: forall m a d x r. (Monad m, FactorialMonoid x, AncestorFunctor a d)               => (x -> Coroutine d m r) -> Source m a x -> Coroutine d m ()-mapMStream_ f = mapMStreamChunks_ (mapM_ f)+mapMStream_ f = mapMStreamChunks_ (Factorial.mapM_ f)  -- | Like 'mapMStream_' except it runs the argument function on whole chunks read from the input. mapMStreamChunks_ :: forall m a d x r. (Monad m, Monoid x, AncestorFunctor a d)@@ -443,7 +444,7 @@ foldStream f acc source = loop acc    where loop a = readChunk source readAll                   >>= \r-> case r-                           of ResultPart chunk _ -> loop (foldl f a chunk)+                           of ResultPart chunk _ -> loop (Factorial.foldl f a chunk)                               FinalResult{} -> return a  -- the last chunk must be empty  -- | 'foldMStream' is similar to 'Control.Monad.foldM' except it draws the values from a 'Source' instead of a list and
Control/Concurrent/SCC/Types.hs view
@@ -170,19 +170,19 @@                                                        c1 -> m w, c2 -> m w, c3 -> m    where compose :: PairBinder m -> c1 -> c2 -> c3 -instance forall m x. (Monad m, Monoid x) => +instance {-# OVERLAPS #-} forall m x. (Monad m, Monoid x) =>          PipeableComponentPair m x (Producer m x ()) (Consumer m x ()) (Performer m ())    where compose binder p c = let performPipe :: Coroutine Naught m ((), ())                                   performPipe = pipeG binder (produce p) (consume c)                               in Performer (runCoroutine performPipe >> return ()) -instance forall m x r. (Monad m, Monoid x) => +instance  {-# OVERLAPS #-} forall m x r. (Monad m, Monoid x) =>          PipeableComponentPair m x (Producer m x ()) (Consumer m x r) (Performer m r)    where compose binder p c = let performPipe :: Coroutine Naught m ((), r)                                   performPipe = pipeG binder (produce p) (consume c)                               in Performer (liftM snd $ runCoroutine performPipe) -instance forall m x r. (Monad m, Monoid x) => +instance  {-# OVERLAPS #-} forall m x r. (Monad m, Monoid x) =>          PipeableComponentPair m x (Producer m x r) (Consumer m x ()) (Performer m r)    where compose binder p c = let performPipe :: Coroutine Naught m (r, ())                                   performPipe = pipeG binder (produce p) (consume c)
Shell.hs view
@@ -35,7 +35,7 @@ import Text.Parsec.Language (emptyDef) import Text.Parsec.Token import System.Console.GetOpt-import System.Console.Haskeline+import System.Console.Haskeline (InputT, defaultSettings, getInputLine, runInputT) import System.Environment (getArgs) import System.IO (BufferMode (NoBuffering), hFlush, hIsWritable, hPutStrLn, hReady, hSetBuffering, stderr, stdout) import qualified System.Process as Process
scc.cabal view
@@ -1,10 +1,10 @@ Name:                scc-Version:             0.8.2.1+Version:             0.8.2.2 Cabal-Version:       >= 1.10 Build-Type:          Simple Synopsis:            Streaming component combinators Category:            Control, Combinators, Concurrency-Tested-with:         GHC == 7.4, GHC == 7.6, GHC == 7.8+Tested-with:         GHC == 7.4, GHC == 7.6, GHC == 7.8, GHC == 7.10 Description:   SCC is a layered library of Streaming Component Combinators. The lowest layer in "Control.Concurent.SCC.Streams"   defines stream abstractions and nested producer-consumer coroutine pairs based on the Coroutine monad transformer.@@ -17,7 +17,7 @@  License:             GPL License-file:        LICENSE.txt-Copyright:           (c) 2008-2013 Mario Blazevic+Copyright:           (c) 2008-2015 Mario Blazevic Author:              Mario Blazevic Maintainer:          blamario@yahoo.com Homepage:            http://trac.haskell.org/SCC/