packages feed

conduit-extra 1.1.9.3 → 1.1.10

raw patch · 4 files changed

+50/−1 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Data.Conduit.Zlib: multiple :: Monad m => Conduit ByteString m a -> Conduit ByteString m a
- Data.Conduit.Network.UDP: Message :: {-# UNPACK #-} ~ByteString -> ~SockAddr -> Message
+ Data.Conduit.Network.UDP: Message :: SrictNotUnpackedByteString -> SrictNotUnpackedSockAddr -> Message
- Data.Conduit.Network.UDP: [msgData] :: Message -> {-# UNPACK #-} ~ByteString
+ Data.Conduit.Network.UDP: [msgData] :: Message -> SrictNotUnpackedByteString
- Data.Conduit.Network.UDP: [msgSender] :: Message -> ~SockAddr
+ Data.Conduit.Network.UDP: [msgSender] :: Message -> SrictNotUnpackedSockAddr

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.1.10++* `multiple` combinator for `Data.Conduit.Zlib` [#254](https://github.com/snoyberg/conduit/issues/254)+ ## 1.1.9.3  * Some typo fixes in docs
Data/Conduit/Zlib.hs view
@@ -8,6 +8,8 @@     compress, decompress, gzip, ungzip,     -- * Flushing     compressFlush, decompressFlush,+    -- * Decompression combinators+    multiple,     -- * Re-exported from zlib-bindings     WindowBits (..), defaultWindowBits ) where@@ -160,3 +162,37 @@             PRDone -> return ()             PRNext chunk -> yield' (Chunk chunk) >> close def             PRError e -> lift $ monadThrow e++-- | The standard 'decompress' and 'ungzip' functions will only decompress a+-- single compressed entity from the stream. This combinator will exhaust the+-- stream completely of all individual compressed entities. This is useful for+-- cases where you have a concatenated archive, e.g. @cat file1.gz file2.gz >+-- combined.gz@.+--+-- Usage:+--+-- > sourceFile "combined.gz" $$ multiple ungzip =$ consume+--+-- This combinator will not fail on an empty stream. If you want to ensure that+-- at least one compressed entity in the stream exists, consider a usage such+-- as:+--+-- > sourceFile "combined.gz" $$ (ungzip >> multiple ungzip) =$ consume+--+-- @since 1.1.10+multiple :: Monad m+         => Conduit ByteString m a+         -> Conduit ByteString m a+multiple inner =+    loop+  where+    loop = do+        mbs <- await+        case mbs of+            Nothing -> return ()+            Just bs+                | S.null bs -> loop+                | otherwise -> do+                    leftover bs+                    inner+                    loop
conduit-extra.cabal view
@@ -1,5 +1,5 @@ Name:                conduit-extra-Version:             1.1.9.3+Version:             1.1.10 Synopsis:            Batteries included conduit: adapters for common libraries. Description:     The conduit package itself maintains relative small dependencies. The purpose of this package is to collect commonly used utility functions wrapping other library dependencies, without depending on heavier-weight dependencies. The basic idea is that this package should only depend on haskell-platform packages and conduit.
test/Data/Conduit/ZlibSpec.hs view
@@ -64,3 +64,12 @@                 return (S.concat c', S.concat u')             c' `shouldBe` c             u' `shouldBe` u++        it "multiple compressed values" $ do+            let s1 = "hello"+                s2 = "world"+                src = do+                    C.yield s1 C.$= CZ.gzip+                    C.yield s2 C.$= CZ.gzip+            actual <- src C.$$ CZ.multiple CZ.ungzip C.=$ CL.consume+            S.concat actual `shouldBe` S.concat [s1, s2]