Hello community, here is the log from the commit of package ghc-streaming-commons for openSUSE:Factory checked in at 2018-05-30 12:14:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-streaming-commons (Old) and /work/SRC/openSUSE:Factory/.ghc-streaming-commons.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-streaming-commons" Wed May 30 12:14:13 2018 rev:14 rq:607893 version:0.2.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-streaming-commons/ghc-streaming-commons.changes 2017-09-15 22:14:54.898050434 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-streaming-commons.new/ghc-streaming-commons.changes 2018-05-30 12:27:22.698128637 +0200 @@ -1,0 +2,8 @@ +Mon May 14 17:02:11 UTC 2018 - psim...@suse.com + +- Update streaming-commons to version 0.2.0.0. + * Drop `blaze-builder` dependency + * Update `getAddrInfo` hints to allow hostnames and portnames [#46](https://github.com/fpco/streaming-commons/issues/46) + * Add `isCompleteInflate` + +------------------------------------------------------------------- Old: ---- streaming-commons-0.1.17.tar.gz New: ---- streaming-commons-0.2.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-streaming-commons.spec ++++++ --- /var/tmp/diff_new_pack.caj8va/_old 2018-05-30 12:27:24.270073973 +0200 +++ /var/tmp/diff_new_pack.caj8va/_new 2018-05-30 12:27:24.274073833 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-streaming-commons # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name streaming-commons %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.1.17 +Version: 0.2.0.0 Release: 0 Summary: Common lower-level functions needed by various streaming data libraries License: MIT @@ -29,7 +29,6 @@ BuildRequires: ghc-Cabal-devel BuildRequires: ghc-array-devel BuildRequires: ghc-async-devel -BuildRequires: ghc-blaze-builder-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-directory-devel BuildRequires: ghc-network-devel @@ -82,7 +81,7 @@ %ghc_pkg_recache %files -f %{name}.files -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files %doc ChangeLog.md README.md ++++++ streaming-commons-0.1.17.tar.gz -> streaming-commons-0.2.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/ChangeLog.md new/streaming-commons-0.2.0.0/ChangeLog.md --- old/streaming-commons-0.1.17/ChangeLog.md 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/ChangeLog.md 2018-03-02 14:23:34.000000000 +0100 @@ -1,3 +1,15 @@ +## 0.2.0 + +* Drop `blaze-builder` dependency + +## 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` + ## 0.1.17 * Add `bindPortGenEx` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/Blaze.hs new/streaming-commons-0.2.0.0/Data/Streaming/Blaze.hs --- old/streaming-commons-0.1.17/Data/Streaming/Blaze.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/Blaze.hs 1970-01-01 01:00:00.000000000 +0100 @@ -1,150 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE RankNTypes #-} --- | Convert a stream of blaze-builder @Builder@s into a stream of @ByteString@s. --- --- Adapted from blaze-builder-enumerator, written by myself and Simon Meier. --- --- Note: if you have blaze-builder >= 0.4, 'newBlazeRecv' just calls --- 'Data.Streaming.ByteString.Builder.newByteStringBuilderRecv' - --- Note that the functions here can work in any monad built on top of @IO@ or --- @ST@. -module Data.Streaming.Blaze - ( BlazeRecv - , BlazePopper - , BlazeFinish - , newBlazeRecv - - -- * Buffers - , Buffer - - -- ** Status information - , freeSize - , sliceSize - , bufferSize - - -- ** Creation and modification - , allocBuffer - , reuseBuffer - , nextSlice - - -- ** Conversion to bytestings - , unsafeFreezeBuffer - , unsafeFreezeNonEmptyBuffer - - -- * Buffer allocation strategies - , BufferAllocStrategy - , allNewBuffersStrategy - , reuseBufferStrategy - , defaultStrategy - ) where - -import Blaze.ByteString.Builder -import qualified Data.ByteString as S - -#if MIN_VERSION_blaze_builder(0,4,0) - -import Data.Streaming.ByteString.Builder - -newBlazeRecv :: BufferAllocStrategy -> IO (BlazeRecv, BlazeFinish) -newBlazeRecv = newByteStringBuilderRecv -{-# INLINE newBlazeRecv #-} - -#else /* !MIN_VERSION_blaze_builder(0,4,0) */ - -import Blaze.ByteString.Builder.Internal hiding (insertByteString) -import Blaze.ByteString.Builder.Internal.Types hiding (insertByteString) -import Blaze.ByteString.Builder.Internal.Buffer (execBuildStep) -import Data.IORef - -import Data.Streaming.ByteString.Builder.Buffer - -newBlazeRecv :: BufferAllocStrategy -> IO (BlazeRecv, BlazeFinish) -newBlazeRecv (ioBufInit, nextBuf) = do - refBuf <- newIORef ioBufInit - return (push refBuf, finish refBuf) - where - finish refBuf = do - ioBuf <- readIORef refBuf - buf <- ioBuf - return $ unsafeFreezeNonEmptyBuffer buf - - push refBuf builder = do - refStep <- newIORef $ Left $ unBuilder builder (buildStep finalStep) - return $ popper refBuf refStep - where - finalStep !(BufRange pf _) = return $ Done pf () - - popper refBuf refStep = do - ioBuf <- readIORef refBuf - ebStep <- readIORef refStep - case ebStep of - Left bStep -> do - !buf <- ioBuf - signal <- execBuildStep bStep buf - case signal of - Done op' _ -> do - writeIORef refBuf $ return $ updateEndOfSlice buf op' - return S.empty - BufferFull minSize op' bStep' -> do - let buf' = updateEndOfSlice buf op' - {-# INLINE cont #-} - cont mbs = do - -- sequencing the computation of the next buffer - -- construction here ensures that the reference to the - -- foreign pointer `fp` is lost as soon as possible. - ioBuf' <- nextBuf minSize buf' - writeIORef refBuf ioBuf' - writeIORef refStep $ Left bStep' - case mbs of - Just bs | not $ S.null bs -> return bs - _ -> popper refBuf refStep - cont $ unsafeFreezeNonEmptyBuffer buf' - InsertByteString op' bs bStep' -> do - let buf' = updateEndOfSlice buf op' - let yieldBS = do - nextBuf 1 buf' >>= writeIORef refBuf - writeIORef refStep $ Left bStep' - if S.null bs - then popper refBuf refStep - else return bs - case unsafeFreezeNonEmptyBuffer buf' of - Nothing -> yieldBS - Just bs' -> do - writeIORef refStep $ Right yieldBS - return bs' - Right action -> action - -{- -helper :: (MonadBase base m, PrimMonad base, Monad (t m), MonadTrans t) - => t m (Maybe (Flush Builder)) - -> (Flush S.ByteString -> t m ()) - -> BufferAllocStrategy - -> t m () -helper await' yield' (ioBufInit, nextBuf) = - loop ioBufInit - where - loop ioBuf = do - await' >>= maybe (close ioBuf) (cont' ioBuf) - - cont' ioBuf Flush = push ioBuf flush $ \ioBuf' -> yield' Flush >> loop ioBuf' - cont' ioBuf (Chunk builder) = push ioBuf builder loop - - close ioBuf = do - buf <- lift $ unsafeLiftIO $ ioBuf - maybe (return ()) (yield' . Chunk) (unsafeFreezeNonEmptyBuffer buf) --} - -#endif /* !MIN_VERSION_blaze_builder(0,4,0) */ - --- | Provides a series of @ByteString@s until empty, at which point it provides --- an empty @ByteString@. --- --- Since 0.1.2 -type BlazePopper = IO S.ByteString - -type BlazeRecv = Builder -> IO BlazePopper - -type BlazeFinish = IO (Maybe S.ByteString) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/ByteString/Builder/Buffer.hs new/streaming-commons-0.2.0.0/Data/Streaming/ByteString/Builder/Buffer.hs --- old/streaming-commons-0.1.17/Data/Streaming/ByteString/Builder/Buffer.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/ByteString/Builder/Buffer.hs 2018-03-02 14:23:34.000000000 +0100 @@ -40,8 +40,6 @@ import Data.ByteString.Lazy.Internal (defaultChunkSize) -#if MIN_VERSION_blaze_builder(0,4,0) - import qualified Data.ByteString as S import qualified Data.ByteString.Internal as S import Foreign (Word8, ForeignPtr, Ptr, plusPtr, minusPtr) @@ -197,12 +195,5 @@ | bufferSize buf >= reqSize = return $ return (reuseBuffer buf) | otherwise = return $ allocBuffer reqSize - -#else /* !MIN_VERSION_blaze_builder(0,4,0) */ - -import Blaze.ByteString.Builder.Internal.Buffer - -#endif /* !MIN_VERSION_blaze_builder(0,4,0) */ - defaultStrategy :: BufferAllocStrategy defaultStrategy = allNewBuffersStrategy defaultChunkSize diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/ByteString/Builder/Class.hs new/streaming-commons-0.2.0.0/Data/Streaming/ByteString/Builder/Class.hs --- old/streaming-commons-0.1.17/Data/Streaming/ByteString/Builder/Class.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/ByteString/Builder/Class.hs 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -{-# LANGUAGE CPP #-} --- | Typeclass to stream blaze-builder and bytestring(-builder) @Builder@s. --- --- Since 0.1.10.0 --- -module Data.Streaming.ByteString.Builder.Class - ( StreamingBuilder (..) - , module Data.Streaming.ByteString.Builder - ) where - -import qualified Data.ByteString.Builder -import qualified Data.ByteString.Builder.Internal -import Data.Monoid (Monoid) - -import Data.Streaming.ByteString.Builder hiding (newByteStringBuilderRecv) -import qualified Data.Streaming.ByteString.Builder - -#if !MIN_VERSION_blaze_builder(0,4,0) - -import qualified Blaze.ByteString.Builder - -import Data.Streaming.Blaze - -instance StreamingBuilder Blaze.ByteString.Builder.Builder where - newBuilderRecv = newBlazeRecv - builderFlush = Blaze.ByteString.Builder.flush - -#endif /* !MIN_VERSION_blaze_builder(0,4,0) */ - --- | Typeclass to stream blaze-builder (< 0.4) and bytestring(-builder) @Builder@s. --- This is primarily to aid the transition from blaze-builder to bytestring @Builder@s --- (if using blaze-builder >= 0.4, there is only one instance, since the @Builder@ --- type is shared). --- --- Since 0.1.10.0 --- -class Monoid b => StreamingBuilder b where - newBuilderRecv :: BufferAllocStrategy -> IO (b -> IO BuilderPopper, BuilderFinish) - builderFlush :: b - -instance StreamingBuilder Data.ByteString.Builder.Builder where - newBuilderRecv = Data.Streaming.ByteString.Builder.newByteStringBuilderRecv - builderFlush = Data.ByteString.Builder.Internal.flush diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/ByteString/Builder.hs new/streaming-commons-0.2.0.0/Data/Streaming/ByteString/Builder.hs --- old/streaming-commons-0.1.17/Data/Streaming/ByteString/Builder.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/ByteString/Builder.hs 2018-03-02 14:23:34.000000000 +0100 @@ -19,6 +19,7 @@ ( BuilderRecv , BuilderPopper , BuilderFinish + , newBuilderRecv , newByteStringBuilderRecv -- * toByteStringIO @@ -75,6 +76,10 @@ type BuilderFinish = IO (Maybe S.ByteString) +newBuilderRecv :: BufferAllocStrategy -> IO (BuilderRecv, BuilderFinish) +newBuilderRecv = newByteStringBuilderRecv +{-# INLINE newBuilderRecv #-} + newByteStringBuilderRecv :: BufferAllocStrategy -> IO (BuilderRecv, BuilderFinish) newByteStringBuilderRecv (ioBufInit, nextBuf) = do refBuf <- newIORef ioBufInit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/Network.hs new/streaming-commons-0.2.0.0/Data/Streaming/Network.hs --- old/streaming-commons-0.1.17/Data/Streaming/Network.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/Network.hs 2018-02-18 17:52:03.000000000 +0100 @@ -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 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/Process.hs new/streaming-commons-0.2.0.0/Data/Streaming/Process.hs --- old/streaming-commons-0.1.17/Data/Streaming/Process.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/Process.hs 2018-01-31 16:13:35.000000000 +0100 @@ -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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/Data/Streaming/Zlib.hs new/streaming-commons-0.2.0.0/Data/Streaming/Zlib.hs --- old/streaming-commons-0.1.17/Data/Streaming/Zlib.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/Data/Streaming/Zlib.hs 2018-01-19 09:28:57.000000000 +0100 @@ -27,6 +27,7 @@ , finishInflate , flushInflate , getUnusedInflate + , isCompleteInflate -- * Deflate , Deflate , initDeflate @@ -52,6 +53,7 @@ import Data.ByteString.Lazy.Internal (defaultChunkSize) import Data.Typeable (Typeable) import Control.Exception (Exception) +import Control.Monad (when) import Data.IORef type ZStreamPair = (ForeignPtr ZStreamStruct, ForeignPtr CChar) @@ -62,6 +64,7 @@ data Inflate = Inflate ZStreamPair (IORef S.ByteString) -- last ByteString fed in, needed for getUnusedInflate + (IORef Bool) -- set True when zlib indicates that inflation is complete (Maybe S.ByteString) -- dictionary -- | The state of a deflation (eg, compression) process. All allocated memory @@ -95,6 +98,9 @@ instance Exception ZlibException -- | Some constants for the error codes, used internally +zStreamEnd :: CInt +zStreamEnd = 1 + zNeedDict :: CInt zNeedDict = 2 @@ -113,9 +119,10 @@ withForeignPtr fbuff $ \buff -> c_set_avail_out zstr buff $ fromIntegral defaultChunkSize lastBS <- newIORef S.empty - return $ Inflate (fzstr, fbuff) lastBS Nothing + complete <- newIORef False + return $ Inflate (fzstr, fbuff) lastBS complete Nothing --- | Initialize an inflation process with the given 'WindowBits'. +-- | Initialize an inflation process with the given 'WindowBits'. -- Unlike initInflate a dictionary for inflation is set which must -- match the one set during compression. initInflateWithDictionary :: WindowBits -> S.ByteString -> IO Inflate @@ -128,7 +135,8 @@ withForeignPtr fbuff $ \buff -> c_set_avail_out zstr buff $ fromIntegral defaultChunkSize lastBS <- newIORef S.empty - return $ Inflate (fzstr, fbuff) lastBS (Just bs) + complete <- newIORef False + return $ Inflate (fzstr, fbuff) lastBS complete (Just bs) -- | Initialize a deflation process with the given compression level and -- 'WindowBits'. You will need to call 'feedDeflate' to feed uncompressed @@ -178,7 +186,7 @@ :: Inflate -> S.ByteString -> IO Popper -feedInflate (Inflate (fzstr, fbuff) lastBS inflateDictionary) bs = do +feedInflate (Inflate (fzstr, fbuff) lastBS complete inflateDictionary) bs = do -- Write the BS to lastBS for use by getUnusedInflate. This is -- theoretically unnecessary, since we could just grab the pointer from the -- fzstr when needed. However, in that case, we wouldn't be holding onto a @@ -193,15 +201,17 @@ where inflate zstr = do res <- c_call_inflate_noflush zstr - if (res == zNeedDict) + res2 <- if (res == zNeedDict) then maybe (return zNeedDict) (\dict -> (unsafeUseAsCStringLen dict $ \(cstr, len) -> do c_call_inflate_set_dictionary zstr cstr $ fromIntegral len c_call_inflate_noflush zstr)) inflateDictionary else return res + 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 @@ -243,7 +253,7 @@ -- data, you will likely have some data still sitting in the buffer. This -- function will return it to you. finishInflate :: Inflate -> IO S.ByteString -finishInflate (Inflate (fzstr, fbuff) _ _) = +finishInflate (Inflate (fzstr, fbuff) _ _ _) = withForeignPtr fzstr $ \zstr -> withForeignPtr fbuff $ \buff -> do avail <- c_get_avail_out zstr @@ -267,11 +277,18 @@ -- -- Since 0.1.11 getUnusedInflate :: Inflate -> IO S.ByteString -getUnusedInflate (Inflate (fzstr, _) ref _) = do +getUnusedInflate (Inflate (fzstr, _) ref _ _) = do bs <- readIORef ref len <- withForeignPtr fzstr c_get_avail_in return $ S.drop (S.length bs - fromIntegral len) bs +-- | Returns True if the inflater has reached end-of-stream, or False if +-- it is still expecting more data. +-- +-- Since 0.1.18 +isCompleteInflate :: Inflate -> IO Bool +isCompleteInflate (Inflate _ _ complete _) = readIORef complete + -- | Feed the given 'S.ByteString' to the deflater. Return a 'Popper', -- an IO action that returns the compressed data a chunk at a time. -- The 'Popper' must be called to exhaustion before using the 'Deflate' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/README.md new/streaming-commons-0.2.0.0/README.md --- old/streaming-commons-0.1.17/README.md 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/README.md 2018-01-31 16:13:39.000000000 +0100 @@ -5,6 +5,7 @@ Intended to be shared by libraries like conduit and pipes. [![Build Status](https://travis-ci.org/fpco/streaming-commons.svg)](https://travis-ci.org/fpco/streaming-commons) +[![Build status](https://ci.appveyor.com/api/projects/status/gn0gn4po97su2iyk/branch/master?svg=true)](https://ci.appveyor.com/project/snoyberg/streaming-commons/branch/master) Dependencies ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/bench/builder-to-bytestring-io.hs new/streaming-commons-0.2.0.0/bench/builder-to-bytestring-io.hs --- old/streaming-commons-0.1.17/bench/builder-to-bytestring-io.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/bench/builder-to-bytestring-io.hs 2018-01-19 09:39:56.000000000 +0100 @@ -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'))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/bench/count-chars.hs new/streaming-commons-0.2.0.0/bench/count-chars.hs --- old/streaming-commons-0.1.17/bench/count-chars.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/bench/count-chars.hs 2018-01-19 09:37:53.000000000 +0100 @@ -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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/streaming-commons.cabal new/streaming-commons-0.2.0.0/streaming-commons.cabal --- old/streaming-commons-0.1.17/streaming-commons.cabal 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/streaming-commons.cabal 2018-03-02 14:23:34.000000000 +0100 @@ -1,5 +1,5 @@ name: streaming-commons -version: 0.1.17 +version: 0.2.0.0 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: mich...@snoyman.com --- copyright: +-- copyright: category: Data build-type: Simple cabal-version: >=1.8 @@ -25,10 +25,8 @@ default: False library - exposed-modules: Data.Streaming.Blaze - Data.Streaming.ByteString.Builder + exposed-modules: Data.Streaming.ByteString.Builder Data.Streaming.ByteString.Builder.Buffer - Data.Streaming.ByteString.Builder.Class Data.Streaming.FileRead Data.Streaming.Filesystem Data.Streaming.Network @@ -47,10 +45,9 @@ 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 , bytestring , directory , network >= 2.4.0.0 @@ -85,7 +82,6 @@ type: exitcode-stdio-1.0 ghc-options: -Wall -threaded other-modules: Data.Streaming.ByteString.BuilderSpec - Data.Streaming.BlazeSpec Data.Streaming.FileReadSpec Data.Streaming.FilesystemSpec Data.Streaming.NetworkSpec @@ -99,7 +95,6 @@ , QuickCheck , array , async - , blaze-builder , bytestring , deepseq , network >= 2.4.0.0 @@ -121,7 +116,7 @@ type: exitcode-stdio-1.0 hs-source-dirs: bench build-depends: base - , criterion + , gauge , bytestring , text , streaming-commons @@ -144,9 +139,8 @@ main-is: builder-to-bytestring-io.hs ghc-options: -Wall -O2 build-depends: base - , blaze-builder - , bytestring - , criterion + , bytestring >= 0.10.2 + , gauge , deepseq , streaming-commons diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/test/Data/Streaming/BlazeSpec.hs new/streaming-commons-0.2.0.0/test/Data/Streaming/BlazeSpec.hs --- old/streaming-commons-0.1.17/test/Data/Streaming/BlazeSpec.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/test/Data/Streaming/BlazeSpec.hs 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -module Data.Streaming.BlazeSpec (spec) where - -import Test.Hspec -import qualified Blaze.ByteString.Builder as B -import Data.Streaming.ByteString.BuilderSpec hiding (spec) - -spec :: Spec -spec = do - describe "Data.Streaming.Blaze" $ builderSpec BuilderFunctions - { bfFromByteString = B.fromByteString - , bfInsertLazyByteString = B.insertLazyByteString - , bfToLazyByteString = B.toLazyByteString - , bfInsertByteString = B.insertByteString - , bfCopyByteString = B.copyByteString - } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/test/Data/Streaming/ByteString/BuilderSpec.hs new/streaming-commons-0.2.0.0/test/Data/Streaming/ByteString/BuilderSpec.hs --- old/streaming-commons-0.1.17/test/Data/Streaming/ByteString/BuilderSpec.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/test/Data/Streaming/ByteString/BuilderSpec.hs 2018-03-02 14:23:34.000000000 +0100 @@ -3,14 +3,13 @@ {-# LANGUAGE ScopedTypeVariables #-} module Data.Streaming.ByteString.BuilderSpec ( spec - , builderSpec - , BuilderFunctions(..) ) where import qualified Data.ByteString as S import Data.ByteString.Char8 () import qualified Data.ByteString.Unsafe as S import qualified Data.ByteString.Builder as B +import Data.ByteString.Builder (Builder) import qualified Data.ByteString.Builder.Internal as B import qualified Data.ByteString.Lazy as L import Data.ByteString.Lazy.Char8 () @@ -21,17 +20,8 @@ import Test.Hspec.QuickCheck (prop) import Data.Streaming.ByteString.Builder -import Data.Streaming.ByteString.Builder.Class -data BuilderFunctions b = BuilderFunctions - { bfFromByteString :: S.ByteString -> b - , bfInsertLazyByteString :: L.ByteString -> b - , bfToLazyByteString :: b -> L.ByteString - , bfInsertByteString :: S.ByteString -> b - , bfCopyByteString :: S.ByteString -> b - } - -tester :: StreamingBuilder b => BufferAllocStrategy -> [b] -> IO [S.ByteString] +tester :: BufferAllocStrategy -> [Builder] -> IO [S.ByteString] tester strat builders0 = do (recv, finish) <- newBuilderRecv strat let loop front [] = do @@ -47,15 +37,14 @@ go front0 loop id builders0 -testerFlush :: StreamingBuilder b - => BufferAllocStrategy -> [Maybe b] -> IO [Maybe S.ByteString] +testerFlush :: BufferAllocStrategy -> [Maybe Builder] -> IO [Maybe S.ByteString] testerFlush strat builders0 = do (recv, finish) <- newBuilderRecv strat let loop front [] = do mbs <- finish return $ front $ maybe [] (return . Just) mbs loop front0 (mbu:bus) = do - popper <- recv $ fromMaybe builderFlush mbu + popper <- recv $ fromMaybe B.flush mbu let go front = do bs <- popper if S.null bs @@ -67,55 +56,48 @@ go front0 loop id builders0 -builderSpec :: forall b. StreamingBuilder b => BuilderFunctions b -> Spec -builderSpec BuilderFunctions{..} = do +builderSpec :: Spec +builderSpec = do prop "idempotent to toLazyByteString" $ \bss' -> do let bss = map S.pack bss' - let builders :: [b] - builders = map bfFromByteString bss - let lbs = bfToLazyByteString $ mconcat builders + let builders = map B.byteString bss + let lbs = B.toLazyByteString $ mconcat builders outBss <- tester defaultStrategy builders L.fromChunks outBss `shouldBe` lbs it "works for large input" $ do - let builders :: [b] - builders = replicate 10000 (bfFromByteString "hello world!" :: b) - let lbs = bfToLazyByteString $ mconcat builders + let builders = replicate 10000 (B.byteString "hello world!") + let lbs = B.toLazyByteString $ mconcat builders outBss <- tester defaultStrategy builders L.fromChunks outBss `shouldBe` lbs it "works for lazy bytestring insertion" $ do - let builders :: [b] - builders = replicate 10000 (bfInsertLazyByteString "hello world!") - let lbs = bfToLazyByteString $ mconcat builders + let builders = replicate 10000 (B.lazyByteStringInsert "hello world!") + let lbs = B.toLazyByteString $ mconcat builders outBss <- tester defaultStrategy builders L.fromChunks outBss `shouldBe` lbs prop "works for strict bytestring insertion" $ \bs' -> do let bs = S.pack bs' - let builders :: [b] - builders = replicate 10000 (bfCopyByteString bs `mappend` bfInsertByteString bs) - let lbs = bfToLazyByteString $ mconcat builders + let builders = replicate 10000 (B.byteStringCopy bs `Data.Monoid.mappend` B.byteStringInsert bs) + let lbs = B.toLazyByteString $ mconcat builders outBss <- tester defaultStrategy builders L.fromChunks outBss `shouldBe` lbs it "flush shouldn't bring in empty strings." $ do let dat = ["hello", "world"] - builders :: [b] - builders = map ((`mappend` builderFlush) . bfFromByteString) dat + builders = map ((`mappend` B.flush) . B.byteString) dat out <- tester defaultStrategy builders dat `shouldBe` out prop "flushing" $ \bss' -> do let bss = concatMap (\bs -> [Just $ S.pack bs, Nothing]) $ filter (not . null) bss' - let builders :: [Maybe b] - builders = map (fmap bfFromByteString) bss + let builders = map (fmap B.byteString) bss outBss <- testerFlush defaultStrategy builders outBss `shouldBe` bss it "large flush input" $ do let lbs = L.pack $ concat $ replicate 100000 [0..255] - chunks :: [Maybe b] - chunks = map (Just . bfFromByteString) (L.toChunks lbs) + chunks = map (Just . B.byteString) (L.toChunks lbs) bss <- testerFlush defaultStrategy chunks L.fromChunks (catMaybes bss) `shouldBe` lbs @@ -123,13 +105,7 @@ spec = describe "Data.Streaming.ByteString.Builder" $ do - builderSpec BuilderFunctions - { bfFromByteString = B.byteString - , bfInsertLazyByteString = B.lazyByteStringInsert - , bfToLazyByteString = B.toLazyByteString - , bfInsertByteString = B.byteStringInsert - , bfCopyByteString = B.byteStringCopy - } + builderSpec prop "toByteStringIO idempotent to toLazyByteString" $ \bss' -> do let bss = mconcat (map (B.byteString . S.pack) bss') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/test/Data/Streaming/FilesystemSpec.hs new/streaming-commons-0.2.0.0/test/Data/Streaming/FilesystemSpec.hs --- old/streaming-commons-0.1.17/test/Data/Streaming/FilesystemSpec.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/test/Data/Streaming/FilesystemSpec.hs 2018-01-19 09:37:53.000000000 +0100 @@ -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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/streaming-commons-0.1.17/test/Data/Streaming/ZlibSpec.hs new/streaming-commons-0.2.0.0/test/Data/Streaming/ZlibSpec.hs --- old/streaming-commons-0.1.17/test/Data/Streaming/ZlibSpec.hs 2017-01-23 15:00:32.000000000 +0100 +++ new/streaming-commons-0.2.0.0/test/Data/Streaming/ZlibSpec.hs 2018-01-19 09:37:53.000000000 +0100 @@ -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