streaming-commons 0.1.18 → 0.1.19
raw patch · 12 files changed
+36/−29 lines, 12 filesdep +gaugedep −criteriondep ~basedep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependencies added: gauge
Dependencies removed: criterion
Dependency ranges changed: base, bytestring
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Data/Streaming/ByteString/Builder/Class.hs +1/−1
- Data/Streaming/Network.hs +1/−2
- Data/Streaming/Process.hs +3/−3
- Data/Streaming/Zlib.hs +1/−1
- README.md +1/−0
- bench/builder-to-bytestring-io.hs +3/−13
- bench/count-chars.hs +1/−1
- streaming-commons.cabal +6/−6
- test/Data/Streaming/ByteString/BuilderSpec.hs +1/−1
- test/Data/Streaming/FilesystemSpec.hs +1/−1
- test/Data/Streaming/ZlibSpec.hs +13/−0
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.1.19++* Update `getAddrInfo` hints to allow hostnames and portnames [#46](https://github.com/fpco/streaming-commons/issues/46)+ ## 0.1.18 * Add `isCompleteInflate`
Data/Streaming/ByteString/Builder/Class.hs view
@@ -34,7 +34,7 @@ -- -- Since 0.1.10.0 ---class Monoid b => StreamingBuilder b where+class Data.Monoid.Monoid b => StreamingBuilder b where newBuilderRecv :: BufferAllocStrategy -> IO (b -> IO BuilderPopper, BuilderFinish) builderFlush :: b
Data/Streaming/Network.hs view
@@ -158,8 +158,7 @@ bindPortGenEx sockOpts sockettype p s = do let hints = NS.defaultHints { NS.addrFlags = [ NS.AI_PASSIVE- , NS.AI_NUMERICSERV- , NS.AI_NUMERICHOST+ , NS.AI_ADDRCONFIG ] , NS.addrSocketType = sockettype }
Data/Streaming/Process.hs view
@@ -31,7 +31,7 @@ , module System.Process ) where -import Control.Applicative ((<$>), (<*>))+import Control.Applicative as A ((<$>), (<*>)) import Control.Concurrent (forkIOWithUnmask) import Control.Concurrent.STM (STM, TMVar, atomically, newEmptyTMVar, putTMVar,@@ -176,8 +176,8 @@ mclose = maybe (return ()) hClose (,,,)- <$> getStdin stdinH- <*> getStdout stdoutH+ A.<$> getStdin stdinH+ A.<*> getStdout stdoutH <*> getStderr stderrH <*> return (StreamingProcessHandle ph ec close)
Data/Streaming/Zlib.hs view
@@ -211,7 +211,7 @@ when (res2 == zStreamEnd) (writeIORef complete True) return res2 --- | An IO action that returns the next chunk of data, returning 'Nothing' when+-- | An IO action that returns the next chunk of data, returning 'PRDone' when -- there is no more data to be popped. type Popper = IO PopperRes
README.md view
@@ -5,6 +5,7 @@ Intended to be shared by libraries like conduit and pipes. [](https://travis-ci.org/fpco/streaming-commons)+[](https://ci.appveyor.com/project/snoyberg/streaming-commons/branch/master) Dependencies ------------
bench/builder-to-bytestring-io.hs view
@@ -1,27 +1,20 @@ {-# LANGUAGE ScopedTypeVariables #-} -import qualified Blaze.ByteString.Builder as ZB-import Criterion.Main+import Gauge.Main import qualified Data.ByteString.Char8 as S import qualified Data.ByteString.Builder as BB-import Data.Monoid (mconcat, Monoid)+import Data.Monoid import qualified Data.Streaming.ByteString.Builder as BB main :: IO () main = defaultMain [ bgroup "Data.Streaming.ByteString.Builder.toByteStringIO" (benchmarks bIO b100_10000 b10000_100 b10000_10000)- , bgroup "Blaze.ByteString.Builder.toByteStringIO"- (benchmarks zIO z100_10000 z10000_100 z10000_10000) , bgroup "Data.ByteString.Builder.toLazyByteString" (benchmarks bLazy b100_10000 b10000_100 b10000_10000)- , bgroup "Blaze.ByteString.Builder.toLazyByteString"- (benchmarks zLazy z100_10000 z10000_100 z10000_10000) ] where bIO = whnfIO . BB.toByteStringIO (const (return ()))- zIO = whnfIO . ZB.toByteStringIO (const (return ())) bLazy = nf BB.toLazyByteString- zLazy = nf ZB.toLazyByteString benchmarks run bld100_10000 bld10000_100 bld10000_10000 = [ bench' run bld100_10000 100 10000 , bench' run bld10000_100 10000 100@@ -32,8 +25,5 @@ b100_10000 = bld BB.byteString 100 10000 b10000_100 = bld BB.byteString 10000 100 b10000_10000 = bld BB.byteString 10000 10000- z100_10000 = bld ZB.fromByteString 100 10000- z10000_100 = bld ZB.fromByteString 10000 100- z10000_10000 = bld ZB.fromByteString 10000 10000- bld :: Monoid a => (S.ByteString -> a) -> Int -> Int -> a+ bld :: Data.Monoid.Monoid a => (S.ByteString -> a) -> Int -> Int -> a bld f len reps = mconcat (replicate reps (f (S.replicate len 'x')))
bench/count-chars.hs view
@@ -1,4 +1,4 @@-import Criterion.Main+import Gauge.Main import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TLE
streaming-commons.cabal view
@@ -1,5 +1,5 @@ name: streaming-commons-version: 0.1.18+version: 0.1.19 synopsis: Common lower-level functions needed by various streaming data libraries description: Provides low-dependency functionality commonly needed by various streaming data libraries, such as conduit and pipes. homepage: https://github.com/fpco/streaming-commons@@ -7,7 +7,7 @@ license-file: LICENSE author: Michael Snoyman, Emanuel Borsboom maintainer: michael@snoyman.com--- copyright: +-- copyright: category: Data build-type: Simple cabal-version: >=1.8@@ -47,7 +47,7 @@ Data.Text.Internal.Encoding.Utf16 Data.Text.Internal.Encoding.Utf32 - build-depends: base >= 4.4 && < 5+ build-depends: base >= 4.7 && < 5 , array , async , blaze-builder >= 0.3 && < 0.5@@ -121,7 +121,7 @@ type: exitcode-stdio-1.0 hs-source-dirs: bench build-depends: base- , criterion+ , gauge , bytestring , text , streaming-commons@@ -145,8 +145,8 @@ ghc-options: -Wall -O2 build-depends: base , blaze-builder- , bytestring- , criterion+ , bytestring >= 0.10.2+ , gauge , deepseq , streaming-commons
test/Data/Streaming/ByteString/BuilderSpec.hs view
@@ -94,7 +94,7 @@ prop "works for strict bytestring insertion" $ \bs' -> do let bs = S.pack bs' let builders :: [b]- builders = replicate 10000 (bfCopyByteString bs `mappend` bfInsertByteString bs)+ builders = replicate 10000 (bfCopyByteString bs `Data.Monoid.mappend` bfInsertByteString bs) let lbs = bfToLazyByteString $ mconcat builders outBss <- tester defaultStrategy builders L.fromChunks outBss `shouldBe` lbs
test/Data/Streaming/FilesystemSpec.hs view
@@ -7,7 +7,7 @@ import Data.List (sort) #if !WINDOWS import System.Posix.Files (removeLink, createSymbolicLink, createNamedPipe)-import Control.Exception (bracket, try, IOException)+import Control.Exception (try, IOException) #endif spec :: Spec
test/Data/Streaming/ZlibSpec.hs view
@@ -31,6 +31,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e instance Arbitrary L.ByteString where arbitrary = L.fromChunks `fmap` arbitrary@@ -50,6 +51,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e license :: S.ByteString license = S8.filter (/= '\r') $ unsafePerformIO $ S.readFile "LICENSE"@@ -70,6 +72,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e inflateWithDict :: S.ByteString -> L.ByteString -> L.ByteString inflateWithDict dict compressed = unsafePerformIO $ do@@ -84,6 +87,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e spec :: Spec spec = describe "Data.Streaming.Zlib" $ do@@ -107,6 +111,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e def <- initDeflate 8 $ WindowBits 31 gziped <- feedDeflate def license >>= go id gziped' <- go gziped $ finishDeflate def@@ -119,6 +124,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e gziped <- S.readFile "test/LICENSE.gz" inf <- initInflate $ WindowBits 31 popper <- feedInflate inf gziped@@ -133,6 +139,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e def <- initDeflate 5 $ WindowBits 31 gziped <- foldM (go' def) id $ map S.singleton $ S.unpack license gziped' <- go gziped $ finishDeflate def@@ -146,6 +153,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e gziped <- S.readFile "test/LICENSE.gz" let gziped' = map S.singleton $ S.unpack gziped inf <- initInflate $ WindowBits 31@@ -162,6 +170,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e inf <- initInflate defaultWindowBits inflated <- foldM (go' inf) id $ L.toChunks glbs final <- finishInflate inf@@ -173,6 +182,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e def <- initDeflate 7 defaultWindowBits deflated <- foldM (go' def) id $ L.toChunks lbs deflated' <- go deflated $ finishDeflate def@@ -191,6 +201,7 @@ PRNext x -> do xs <- popList pop return $ x : xs+ PRError e -> throwIO e let callback name expected pop = do bssDeflated <- popList pop@@ -256,6 +267,7 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e compressRaw :: L.ByteString -> IO L.ByteString compressRaw raw = do@@ -270,3 +282,4 @@ case y of PRDone -> return front PRNext z -> go (front . (:) z) x+ PRError e -> throwIO e