streaming-bytestring 0.1.2.0 → 0.1.2.2
raw patch · 4 files changed
+18/−18 lines, 4 filesdep ~streaming
Dependency ranges changed: streaming
Files
- Data/ByteString/Streaming.hs +10/−10
- Data/ByteString/Streaming/Char8.hs +4/−4
- Data/ByteString/Streaming/Internal.hs +2/−2
- streaming-bytestring.cabal +2/−2
Data/ByteString/Streaming.hs view
@@ -288,7 +288,7 @@ dematerialize bs return (\b mx -> Step (b:> mx))- Delay+ Effect {-#INLINE toChunks#-} {-| /O(1)/ yield a strict 'ByteString' chunk. @@ -1099,7 +1099,7 @@ -- splitWith :: Monad m => (Word8 -> Bool) -> ByteString m r -> Stream (ByteString m) m r splitWith _ (Empty r) = Return r-splitWith p (Go m) = Delay $ liftM (splitWith p) m+splitWith p (Go m) = Effect $ liftM (splitWith p) m splitWith p (Chunk c0 cs0) = comb [] (S.splitWith p c0) cs0 where -- comb :: [P.ByteString] -> [P.ByteString] -> ByteString -> [ByteString]@@ -1108,7 +1108,7 @@ (Empty (Return r)) (s:acc) comb acc [s] (Chunk c cs) = comb (s:acc) (S.splitWith p c) cs- comb acc b (Go m) = Delay (liftM (comb acc b) m)+ comb acc b (Go m) = Effect (liftM (comb acc b) m) comb acc (s:ss) cs = Step $ L.foldl' (flip Chunk) (Empty (comb [] ss cs)) (s:acc)@@ -1138,13 +1138,13 @@ where loop !x = case x of Empty r -> Return r- Go m -> Delay $ liftM loop m+ Go m -> Effect $ liftM loop m Chunk c0 cs0 -> comb [] (S.split w c0) cs0 comb !acc [] (Empty r) = Step $ revChunks acc (Return r) comb acc [] (Chunk c cs) = comb acc (S.split w c) cs comb !acc (s:[]) (Empty r) = Step $ revChunks (s:acc) (Return r) comb acc (s:[]) (Chunk c cs) = comb (s:acc) (S.split w c) cs- comb acc b (Go m) = Delay (liftM (comb acc b) m)+ comb acc b (Go m) = Effect (liftM (comb acc b) m) comb acc (s:ss) cs = Step $ revChunks (s:acc) (comb [] ss cs) {-# INLINABLE split #-} @@ -1164,7 +1164,7 @@ group = go where go (Empty r) = Return r- go (Go m) = Delay $ liftM go m+ go (Go m) = Effect $ liftM go m go (Chunk c cs) | S.length c == 1 = Step $ to [c] (S.unsafeHead c) cs | otherwise = Step $ to [S.unsafeTake 1 c] (S.unsafeHead c)@@ -1207,14 +1207,14 @@ -- argument between each element of the list. intercalate :: Monad m => ByteString m () -> Stream (ByteString m) m r -> ByteString m r intercalate _ (Return r) = Empty r-intercalate s (Delay m) = Go $ liftM (intercalate s) m+intercalate s (Effect m) = Go $ liftM (intercalate s) m intercalate s (Step bs0) = do -- this isn't quite right ls <- bs0 s intercalate s ls -- where -- loop (Return r) = Empty r -- concat . (L.intersperse s)- -- loop (Delay m) = Go $ liftM loop m+ -- loop (Effect m) = Go $ liftM loop m -- loop (Step bs) = do -- ls <- bs -- case ls of@@ -1617,7 +1617,7 @@ loop a@(x:xs) ls = case ls of Return r -> Return r Step fls -> Step $ fmap (loop xs) (op x fls)- Delay mls -> Delay $ liftM (loop a) mls+ Effect mls -> Effect $ liftM (loop a) mls {-#INLINABLE zipWithStream #-} @@ -1675,7 +1675,7 @@ case p of Return _ -> runBuilderWith mempty bstep r Step (b :> rest) -> runBuilderWith (b `mappend` concatBuilders rest) bstep r - Delay m -> m >>= \p' -> runBuilderWith (concatBuilders p') bstep r+ Effect m -> m >>= \p' -> runBuilderWith (concatBuilders p') bstep r {-#INLINABLE concatBuilders #-}
Data/ByteString/Streaming/Char8.hs view
@@ -191,7 +191,7 @@ unpack :: Monad m => ByteString m r -> Stream (Of Char) m r unpack bs = case bs of Empty r -> Return r- Go m -> Delay (liftM unpack m)+ Go m -> Effect (liftM unpack m) Chunk c cs -> unpackAppendCharsLazy c (unpack cs) where unpackAppendCharsLazy :: B.ByteString -> Stream (Of Char) m r -> Stream (Of Char) m r@@ -494,7 +494,7 @@ Chunk "" (Empty r) -> Empty r Chunk "\n" (Empty r) -> bs _ -> cons' '\n' bs- Delay m -> Go (liftM unlines m)+ Effect m -> Go (liftM unlines m) {-#INLINABLE unlines #-} -- | 'words' breaks a byte stream up into a succession of byte streams @@ -509,8 +509,8 @@ where filtered stream = case stream of Return r -> Return r- Delay m -> Delay (liftM filtered m)- Step bs -> Delay $ bs_loop bs + Effect m -> Effect (liftM filtered m)+ Step bs -> Effect $ bs_loop bs bs_loop bs = case bs of Empty r -> return $ filtered r Go m -> m >>= bs_loop
Data/ByteString/Streaming/Internal.hs view
@@ -242,7 +242,7 @@ [] -> case rest of Return r -> Empty r Step as -> packBytes (Step as) -- these two pattern matches- Delay m -> Go $ liftM packBytes m -- should be evaded.+ Effect m -> Go $ liftM packBytes m -- should be evaded. _ -> Chunk (S.packBytes bytes) (packBytes rest) {-#INLINABLE packBytes #-} @@ -256,7 +256,7 @@ unpackBytes bss = dematerialize bss Return unpackAppendBytesLazy- Delay+ Effect where unpackAppendBytesLazy :: S.ByteString -> Stream (Of Word8) m r -> Stream (Of Word8) m r unpackAppendBytesLazy (S.PS fp off len) xs
streaming-bytestring.cabal view
@@ -1,5 +1,5 @@ name: streaming-bytestring-version: 0.1.2.0+version: 0.1.2.2 synopsis: effectful byte steams, or: bytestring io done right. description: This is an implementation of effectful, memory-constrained @@ -189,7 +189,7 @@ , mtl >=2.1 && <2.3 , mmorph >=1.0 && <1.2 , transformers >=0.3 && <0.5- , streaming > 0.1.1.1 && < 0.1.2.2+ , streaming > 0.1.2.0 && < 0.1.2.4 if impl(ghc < 7.8) build-depends: bytestring < 0.10.4.0