packages feed

streaming 0.1.0.8 → 0.1.0.9

raw patch · 4 files changed

+33/−4 lines, 4 files

Files

Streaming.hs view
@@ -40,6 +40,7 @@     -- * Splitting and joining 'Stream's     splitsAt,+   takes,    chunksOf,    concats, 
Streaming/Internal.hs view
@@ -37,6 +37,7 @@     -- *  Splitting streams     , chunksOf      , splitsAt+    , takes          -- * Zipping streams     , zipsWith@@ -381,7 +382,11 @@         Step fs        -> case n of            0 -> Return (Step fs)           _ -> Step (fmap (loop (n-1)) fs)-{-# INLINABLE splitsAt #-}                        +{-# INLINABLE splitsAt #-}  +                      +takes :: (Monad m, Functor f) => Int -> Stream f m r -> Stream f m ()+takes n = void . splitsAt n+{-# INLINE takes #-}                          {-| Break a stream into substreams each with n functorial layers.  
Streaming/Prelude.hs view
@@ -94,6 +94,8 @@     , splitAt     , break     , span+    , group+    , groupBy  --   , split          -- * Folds@@ -261,8 +263,12 @@  > cons a stream = yield a >> stream -Useful for interoperation +   Useful for interoperation: +> Data.Text.foldr S.cons (return ()) :: Text -> Stream (Of Char) m ()+> Lazy.foldrChunks S.cons (return ()) :: Lazy.ByteString -> Stream (Of Strict.ByteString) m ()++    and so on. -}  cons :: (Monad m) => a -> Stream (Of a) m r -> Stream (Of a) m r@@ -610,6 +616,23 @@       loop rest {-# INLINEABLE for #-} ++groupBy :: Monad m  +  => (a -> a -> Bool)+  -> Stream (Of a) m r +  -> Stream (Stream (Of a) m) m r+groupBy equals = loop  where+  loop stream = Delay $ do+        e <- next stream+        return $ case e of+            Left   r      -> Return r+            Right (a, p') -> Step $+                fmap loop (yield a >> span (equals a) p')+                +group :: (Monad m, Eq a)  => Stream (Of a) m r -> Stream (Stream (Of a) m) m r                +group = groupBy (==)+                + -- --------------- -- iterate -- ---------------@@ -847,7 +870,7 @@  > Control.Foldl.purely scan :: Monad m => Fold a b -> Stream (Of a) m r -> Stream (Of b) m r ->>> Streaming.print $ Foldl.purely Streaming.scan Foldl.list $ each [3..5]+>>> S.print $ L.purely S.scan L.list $ each [3..5] [] [3] [3,4]
streaming.cabal view
@@ -1,5 +1,5 @@ name:                streaming-version:             0.1.0.8+version:             0.1.0.9 cabal-version:       >=1.10 build-type:          Simple synopsis:            A free monad transformer optimized for streaming applications.