Hello community, here is the log from the commit of package ghc-pipes-bytestring for openSUSE:Factory checked in at 2017-07-23 12:14:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-pipes-bytestring (Old) and /work/SRC/openSUSE:Factory/.ghc-pipes-bytestring.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-pipes-bytestring" Sun Jul 23 12:14:51 2017 rev:4 rq:511918 version:2.1.6 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-pipes-bytestring/ghc-pipes-bytestring.changes 2017-07-05 23:59:31.395063053 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-pipes-bytestring.new/ghc-pipes-bytestring.changes 2017-07-23 12:14:52.251752848 +0200 @@ -1,0 +2,5 @@ +Mon Jul 17 03:01:30 UTC 2017 - psim...@suse.com + +- Update to version 2.1.6. + +------------------------------------------------------------------- Old: ---- pipes-bytestring-2.1.5.tar.gz New: ---- pipes-bytestring-2.1.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-pipes-bytestring.spec ++++++ --- /var/tmp/diff_new_pack.QeHSCI/_old 2017-07-23 12:14:54.087493538 +0200 +++ /var/tmp/diff_new_pack.QeHSCI/_new 2017-07-23 12:14:54.087493538 +0200 @@ -18,7 +18,7 @@ %global pkg_name pipes-bytestring Name: ghc-%{pkg_name} -Version: 2.1.5 +Version: 2.1.6 Release: 0 Summary: ByteString support for pipes License: BSD-3-Clause @@ -31,6 +31,7 @@ BuildRequires: ghc-pipes-group-devel BuildRequires: ghc-pipes-parse-devel BuildRequires: ghc-rpm-macros +BuildRequires: ghc-stringsearch-devel BuildRequires: ghc-transformers-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ pipes-bytestring-2.1.5.tar.gz -> pipes-bytestring-2.1.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pipes-bytestring-2.1.5/pipes-bytestring.cabal new/pipes-bytestring-2.1.6/pipes-bytestring.cabal --- old/pipes-bytestring-2.1.5/pipes-bytestring.cabal 2017-06-15 00:26:37.000000000 +0200 +++ new/pipes-bytestring-2.1.6/pipes-bytestring.cabal 2017-07-14 06:42:49.000000000 +0200 @@ -1,5 +1,5 @@ Name: pipes-bytestring -Version: 2.1.5 +Version: 2.1.6 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3 @@ -23,6 +23,7 @@ pipes >= 4.0 && < 4.4 , pipes-group >= 1.0.0 && < 1.1 , pipes-parse >= 3.0.0 && < 3.1 , + stringsearch >= 0.3.0 && < 0.4 , transformers >= 0.2.0.0 && < 0.6 Exposed-Modules: Pipes.ByteString GHC-Options: -O2 -Wall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pipes-bytestring-2.1.5/src/Pipes/ByteString.hs new/pipes-bytestring-2.1.6/src/Pipes/ByteString.hs --- old/pipes-bytestring-2.1.5/src/Pipes/ByteString.hs 2017-06-15 00:26:37.000000000 +0200 +++ new/pipes-bytestring-2.1.6/src/Pipes/ByteString.hs 2017-07-14 06:42:49.000000000 +0200 @@ -110,6 +110,7 @@ , splitAt , span , break + , breakOn , groupBy , group , word @@ -127,6 +128,7 @@ , chunksOf , splitsWith , splits + , splitOn , groupsBy , groups , lines @@ -150,9 +152,11 @@ import Data.ByteString (ByteString) import Data.ByteString.Internal (isSpaceWord8) import qualified Data.ByteString.Lazy as BL +import qualified Data.ByteString.Search import Data.ByteString.Lazy.Internal (foldrChunks, defaultChunkSize) import Data.ByteString.Unsafe (unsafeTake) import Data.Char (ord) +import Data.Monoid (mempty, (<>)) import Data.Functor.Constant (Constant(Constant, getConstant)) import Data.Functor.Identity (Identity) import qualified Data.List as List @@ -709,6 +713,42 @@ break predicate = span (not . predicate) {-# INLINABLE break #-} +{-| Improper lens that splits at the first occurrence of the pattern. +-} +breakOn + :: Monad m + => ByteString + -> Lens' (Producer ByteString m x) + (Producer ByteString m (Producer ByteString m x)) +breakOn needle k p0 = + fmap join (k (go mempty p0)) + where + len0 = BS.length needle + + go leftovers p = + if BS.length leftovers < len0 + then do + x <- lift (next p) + case x of + Left r -> do + yield leftovers + return (return r) + Right (bytes, p') -> do + go (leftovers <> bytes) p' + else do + let (prefix, suffix) = Data.ByteString.Search.breakOn needle leftovers + if BS.null suffix + then do + let len = BS.length leftovers + let (output, leftovers') = + BS.splitAt (len + 1 - len0) leftovers + yield output + go leftovers' p + else do + yield prefix + return (yield suffix >> p) +{-# INLINABLE breakOn #-} + {-| Improper lens that splits after the first group of matching bytes, as defined by the given equality predicate -} @@ -910,6 +950,26 @@ fmap (PG.intercalates (yield (BS.singleton w8))) (k (splitsWith (w8 ==) p)) {-# INLINABLE splits #-} +-- | Split a byte stream into groups separated by the given `ByteString` +splitOn + :: Monad m + => ByteString + -> Lens' (Producer ByteString m x) (FreeT (Producer ByteString m) m x) +splitOn needle k p0 = + fmap + (PG.intercalates (yield needle)) + (k (go p0)) + where + len0 = BS.length needle + go p = PG.FreeT $ do + x <- next p + return $ case x of + Left r -> PG.Pure r + Right (bs, p') -> PG.Free $ do + p'' <- (yield bs >> p')^.(breakOn needle) + return (go (drop len0 p'')) +{-# INLINABLE splitOn #-} + {-| Isomorphism between a byte stream and groups of identical bytes using the supplied equality predicate -}