Hello community, here is the log from the commit of package ghc-text for openSUSE:Factory checked in at 2015-12-29 12:59:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-text (Old) and /work/SRC/openSUSE:Factory/.ghc-text.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-text" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-text/ghc-text.changes 2015-08-23 17:39:11.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-text.new/ghc-text.changes 2015-12-29 12:59:55.000000000 +0100 @@ -1,0 +2,13 @@ +Thu Dec 24 08:18:58 UTC 2015 - mimi.vx@gmail.com + +- update to 1.2.2.0 +* The integer-simple package, upon which this package optionally depended, has been + replaced with integer-pure. The build flag has been renamed accordingly. +* Bug fix: For the Binary instance, If UTF-8 decoding fails during a get, the error + is propagated via fail instead of an uncatchable crash. +* New function: takeWhileEnd +* New instances for the Text types: + + if base >= 4.7: PrintfArg + + if base >= 4.9: Semigroup + +------------------------------------------------------------------- Old: ---- text-1.2.1.3.tar.gz New: ---- text-1.2.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-text.spec ++++++ --- /var/tmp/diff_new_pack.31YVj7/_old 2015-12-29 12:59:56.000000000 +0100 +++ /var/tmp/diff_new_pack.31YVj7/_new 2015-12-29 12:59:56.000000000 +0100 @@ -17,12 +17,11 @@ %global pkg_name text -%global cabal_configure_options -f -integer-simple %bcond_with tests Name: ghc-text -Version: 1.2.1.3 +Version: 1.2.2.0 Release: 0 Summary: An efficient packed Unicode text type License: BSD-2-Clause ++++++ text-1.2.1.3.tar.gz -> text-1.2.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Encoding/Error.hs new/text-1.2.2.0/Data/Text/Encoding/Error.hs --- old/text-1.2.1.3/Data/Text/Encoding/Error.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Encoding/Error.hs 2015-12-22 21:38:36.000000000 +0100 @@ -1,5 +1,7 @@ {-# LANGUAGE CPP, DeriveDataTypeable #-} -#if __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 704 +{-# LANGUAGE Safe #-} +#elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif -- | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Internal/Builder/Functions.hs new/text-1.2.2.0/Data/Text/Internal/Builder/Functions.hs --- old/text-1.2.1.3/Data/Text/Internal/Builder/Functions.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Internal/Builder/Functions.hs 2015-12-22 21:38:36.000000000 +0100 @@ -23,7 +23,8 @@ import Data.Monoid (mappend) import Data.Text.Lazy.Builder (Builder) -import GHC.Base +import GHC.Base (chr#,ord#,(+#),Int(I#),Char(C#)) +import Prelude () -- | Unsafe conversion for decimal digits. {-# INLINE i2d #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Internal/Builder.hs new/text-1.2.2.0/Data/Text/Internal/Builder.hs --- old/text-1.2.1.3/Data/Text/Internal/Builder.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Internal/Builder.hs 2015-12-22 21:38:36.000000000 +0100 @@ -59,6 +59,9 @@ import Control.Monad.ST (ST, runST) import Data.Monoid (Monoid(..)) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup(..)) +#endif import Data.Text.Internal (Text(..)) import Data.Text.Internal.Lazy (smallChunkSize) import Data.Text.Unsafe (inlineInterleaveST) @@ -89,12 +92,22 @@ -> ST s [S.Text] } +#if MIN_VERSION_base(4,9,0) +instance Semigroup Builder where + (<>) = append + {-# INLINE (<>) #-} +#endif + instance Monoid Builder where mempty = empty {-# INLINE mempty #-} +#if MIN_VERSION_base(4,9,0) + mappend = (<>) -- future-proof definition +#else mappend = append +#endif {-# INLINE mappend #-} - mconcat = foldr mappend mempty + mconcat = foldr mappend Data.Monoid.mempty {-# INLINE mconcat #-} instance String.IsString Builder where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Internal/Fusion/Common.hs new/text-1.2.2.0/Data/Text/Internal/Fusion/Common.hs --- old/text-1.2.1.3/Data/Text/Internal/Fusion/Common.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Internal/Fusion/Common.hs 2015-12-22 21:38:36.000000000 +0100 @@ -593,7 +593,7 @@ {-# INLINE [0] concatMap #-} -- | /O(n)/ any @p @xs determines if any character in the stream --- @xs@ satisifes the predicate @p@. +-- @xs@ satisfies the predicate @p@. any :: (Char -> Bool) -> Stream Char -> Bool any p (Stream next0 s0 _len) = loop_any s0 where @@ -605,7 +605,7 @@ {-# INLINE [0] any #-} -- | /O(n)/ all @p @xs determines if all characters in the 'Text' --- @xs@ satisify the predicate @p@. +-- @xs@ satisfy the predicate @p@. all :: (Char -> Bool) -> Stream Char -> Bool all p (Stream next0 s0 _len) = loop_all s0 where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Internal/Read.hs new/text-1.2.2.0/Data/Text/Internal/Read.hs --- old/text-1.2.1.3/Data/Text/Internal/Read.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Internal/Read.hs 2015-12-22 21:38:36.000000000 +0100 @@ -7,7 +7,7 @@ -- Stability : experimental -- Portability : GHC -- --- Common internal functiopns for reading textual data. +-- Common internal functions for reading textual data. module Data.Text.Internal.Read ( IReader @@ -18,7 +18,7 @@ , perhaps ) where -import Control.Applicative (Applicative(..)) +import Control.Applicative as App (Applicative(..)) import Control.Arrow (first) import Control.Monad (ap) import Data.Char (ord) @@ -38,7 +38,7 @@ (<*>) = ap instance Monad (IParser t) where - return = pure + return = App.pure m >>= k = P $ \t -> case runP m t of Left err -> Left err Right (a,t') -> runP (k a) t' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Lazy/Builder/Int.hs new/text-1.2.2.0/Data/Text/Lazy/Builder/Int.hs --- old/text-1.2.1.3/Data/Text/Lazy/Builder/Int.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Lazy/Builder/Int.hs 2015-12-22 21:38:36.000000000 +0100 @@ -35,15 +35,15 @@ #ifdef __GLASGOW_HASKELL__ # if defined(INTEGER_GMP) -import GHC.Integer.GMP.Internals -# elif defined(INTEGER_SIMPLE) +import GHC.Integer.GMP.Internals (Integer(S#)) +# elif defined(INTEGER_PURE) import GHC.Integer # else -# error "You need to use either GMP or integer-simple." +# error "You need to use either GMP or integer-pure." # endif #endif -#if defined(INTEGER_GMP) || defined(INTEGER_SIMPLE) +#if defined(INTEGER_GMP) || defined(INTEGER_PURE) # define PAIR(a,b) (# a,b #) #else # define PAIR(a,b) (a,b) @@ -55,7 +55,7 @@ {-# RULES "decimal/Int16" decimal = boundedDecimal :: Int16 -> Builder #-} {-# RULES "decimal/Int32" decimal = boundedDecimal :: Int32 -> Builder #-} {-# RULES "decimal/Int64" decimal = boundedDecimal :: Int64 -> Builder #-} -{-# RULES "decimal/Word" decimal = positive :: Word -> Builder #-} +{-# RULES "decimal/Word" decimal = positive :: Data.Word.Word -> Builder #-} {-# RULES "decimal/Word8" decimal = positive :: Word8 -> Builder #-} {-# RULES "decimal/Word16" decimal = positive :: Word16 -> Builder #-} {-# RULES "decimal/Word32" decimal = positive :: Word32 -> Builder #-} @@ -247,7 +247,7 @@ PAIR(x,y) -> pblock q <> pblock r <> putB ns where q = fromInteger x r = fromInteger y - putB _ = mempty + putB _ = Data.Monoid.mempty int :: Int -> Builder int x | base == 10 = decimal x diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Lazy/Encoding.hs new/text-1.2.2.0/Data/Text/Lazy/Encoding.hs --- old/text-1.2.1.3/Data/Text/Lazy/Encoding.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Lazy/Encoding.hs 2015-12-22 21:38:36.000000000 +0100 @@ -62,7 +62,7 @@ import qualified Data.ByteString.Unsafe as B #if MIN_VERSION_bytestring(0,10,4) import Data.Word (Word8) -import Data.Monoid (mappend, mempty) +import Data.Monoid (Monoid(..)) import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Builder.Extra as B (safeStrategy, toLazyByteStringWith) import qualified Data.ByteString.Builder.Prim as BP @@ -161,7 +161,7 @@ encodeUtf8Builder :: Text -> B.Builder encodeUtf8Builder = - foldrChunks (\c b -> TE.encodeUtf8Builder c `mappend` b) mempty + foldrChunks (\c b -> TE.encodeUtf8Builder c `mappend` b) Data.Monoid.mempty {-# INLINE encodeUtf8BuilderEscaped #-} encodeUtf8BuilderEscaped :: BP.BoundedPrim Word8 -> Text -> B.Builder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Lazy/Read.hs new/text-1.2.2.0/Data/Text/Lazy/Read.hs --- old/text-1.2.1.3/Data/Text/Lazy/Read.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Lazy/Read.hs 2015-12-22 21:38:36.000000000 +0100 @@ -1,5 +1,7 @@ {-# LANGUAGE OverloadedStrings, CPP #-} -#if __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 704 +{-# LANGUAGE Safe #-} +#elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif @@ -54,7 +56,7 @@ {-# SPECIALIZE decimal :: Reader Int32 #-} {-# SPECIALIZE decimal :: Reader Int64 #-} {-# SPECIALIZE decimal :: Reader Integer #-} -{-# SPECIALIZE decimal :: Reader Word #-} +{-# SPECIALIZE decimal :: Reader Data.Word.Word #-} {-# SPECIALIZE decimal :: Reader Word8 #-} {-# SPECIALIZE decimal :: Reader Word16 #-} {-# SPECIALIZE decimal :: Reader Word32 #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Lazy.hs new/text-1.2.2.0/Data/Text/Lazy.hs --- old/text-1.2.1.3/Data/Text/Lazy.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Lazy.hs 2015-12-22 21:38:36.000000000 +0100 @@ -140,6 +140,7 @@ , drop , dropEnd , takeWhile + , takeWhileEnd , dropWhile , dropWhileEnd , dropAround @@ -214,6 +215,9 @@ Constr, mkConstr, DataType, mkDataType, Fixity(Prefix)) import Data.Binary (Binary(get, put)) import Data.Monoid (Monoid(..)) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup(..)) +#endif import Data.String (IsString(..)) import qualified Data.Text as T import qualified Data.Text.Internal as T @@ -225,7 +229,7 @@ import Data.Text.Internal.Lazy (Text(..), chunk, empty, foldlChunks, foldrChunks, smallChunkSize) import Data.Text.Internal (firstf, safe, text) -import Data.Text.Lazy.Encoding (decodeUtf8, encodeUtf8) +import Data.Text.Lazy.Encoding (decodeUtf8', encodeUtf8) import qualified Data.Text.Internal.Functions as F import Data.Text.Internal.Lazy.Search (indices) #if __GLASGOW_HASKELL__ >= 702 @@ -237,6 +241,9 @@ import qualified GHC.Exts as Exts #endif import GHC.Prim (Addr#) +#if MIN_VERSION_base(4,7,0) +import Text.Printf (PrintfArg, formatArg, formatString) +#endif -- $fusion -- @@ -334,9 +341,21 @@ instance Read Text where readsPrec p str = [(pack x,y) | (x,y) <- readsPrec p str] +#if MIN_VERSION_base(4,9,0) +-- Semigroup orphan instances for older GHCs are provided by +-- 'semigroups` package + +instance Semigroup Text where + (<>) = append +#endif + instance Monoid Text where mempty = empty +#if MIN_VERSION_base(4,9,0) + mappend = (<>) -- future-proof definition +#else mappend = append +#endif mconcat = concat instance IsString Text where @@ -357,7 +376,11 @@ instance Binary Text where put t = put (encodeUtf8 t) - get = P.fmap decodeUtf8 get + get = do + bs <- get + case decodeUtf8' bs of + P.Left exn -> P.fail (P.show exn) + P.Right a -> P.return a -- | This instance preserves data abstraction at the cost of inefficiency. -- We omit reflection services for the sake of data abstraction. @@ -372,6 +395,12 @@ _ -> error "Data.Text.Lazy.Text.gunfold" dataTypeOf _ = textDataType +#if MIN_VERSION_base(4,7,0) +-- | Only defined for @base-4.7.0.0@ and later +instance PrintfArg Text where + formatArg txt = formatString $ unpack txt +#endif + packConstr :: Constr packConstr = mkConstr textDataType "pack" [] Prefix @@ -852,13 +881,13 @@ {-# INLINE concatMap #-} -- | /O(n)/ 'any' @p@ @t@ determines whether any character in the --- 'Text' @t@ satisifes the predicate @p@. Subject to fusion. +-- 'Text' @t@ satisfies the predicate @p@. Subject to fusion. any :: (Char -> Bool) -> Text -> Bool any p t = S.any p (stream t) {-# INLINE any #-} -- | /O(n)/ 'all' @p@ @t@ determines whether all characters in the --- 'Text' @t@ satisify the predicate @p@. Subject to fusion. +-- 'Text' @t@ satisfy the predicate @p@. Subject to fusion. all :: (Char -> Bool) -> Text -> Bool all p t = S.all p (stream t) {-# INLINE all #-} @@ -1115,6 +1144,20 @@ "LAZY TEXT takeWhile -> unfused" [1] forall p t. unstream (S.takeWhile p (stream t)) = takeWhile p t #-} +-- | /O(n)/ 'takeWhileEnd', applied to a predicate @p@ and a 'Text', +-- returns the longest suffix (possibly empty) of elements that +-- satisfy @p@. +-- Examples: +-- +-- > takeWhileEnd (=='o') "foo" == "oo" +takeWhileEnd :: (Char -> Bool) -> Text -> Text +takeWhileEnd p = takeChunk empty . L.reverse . toChunks + where takeChunk acc [] = acc + takeChunk acc (t:ts) = if T.length t' < T.length t + then (Chunk t' acc) + else takeChunk (Chunk t' acc) ts + where t' = T.takeWhileEnd p t +{-# INLINE takeWhileEnd #-} -- | /O(n)/ 'dropWhile' @p@ @t@ returns the suffix remaining after -- 'takeWhile' @p@ @t@. Subject to fusion. @@ -1133,9 +1176,11 @@ "LAZY TEXT dropWhile -> unfused" [1] forall p t. unstream (S.dropWhile p (stream t)) = dropWhile p t #-} + -- | /O(n)/ 'dropWhileEnd' @p@ @t@ returns the prefix remaining after --- dropping characters that fail the predicate @p@ from the end of +-- dropping characters that satisfy the predicate @p@ from the end of -- @t@. +-- -- Examples: -- -- > dropWhileEnd (=='.') "foo..." == "foo" @@ -1152,7 +1197,7 @@ {-# INLINE dropWhileEnd #-} -- | /O(n)/ 'dropAround' @p@ @t@ returns the substring remaining after --- dropping characters that fail the predicate @p@ from both the +-- dropping characters that satisfy the predicate @p@ from both the -- beginning and end of @t@. Subject to fusion. dropAround :: (Char -> Bool) -> Text -> Text dropAround p = dropWhile p . dropWhileEnd p diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text/Read.hs new/text-1.2.2.0/Data/Text/Read.hs --- old/text-1.2.1.3/Data/Text/Read.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text/Read.hs 2015-12-22 21:38:36.000000000 +0100 @@ -55,7 +55,7 @@ {-# SPECIALIZE decimal :: Reader Int32 #-} {-# SPECIALIZE decimal :: Reader Int64 #-} {-# SPECIALIZE decimal :: Reader Integer #-} -{-# SPECIALIZE decimal :: Reader Word #-} +{-# SPECIALIZE decimal :: Reader Data.Word.Word #-} {-# SPECIALIZE decimal :: Reader Word8 #-} {-# SPECIALIZE decimal :: Reader Word16 #-} {-# SPECIALIZE decimal :: Reader Word32 #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/Data/Text.hs new/text-1.2.2.0/Data/Text.hs --- old/text-1.2.1.3/Data/Text.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/Data/Text.hs 2015-12-22 21:38:36.000000000 +0100 @@ -129,6 +129,7 @@ , drop , dropEnd , takeWhile + , takeWhileEnd , dropWhile , dropWhileEnd , dropAround @@ -214,10 +215,13 @@ import qualified Data.List as L import Data.Binary (Binary(get, put)) import Data.Monoid (Monoid(..)) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup(..)) +#endif import Data.String (IsString(..)) import qualified Data.Text.Internal.Fusion as S import qualified Data.Text.Internal.Fusion.Common as S -import Data.Text.Encoding (decodeUtf8, encodeUtf8) +import Data.Text.Encoding (decodeUtf8', encodeUtf8) import Data.Text.Internal.Fusion (stream, reverseStream, unstream) import Data.Text.Internal.Private (span_) import Data.Text.Internal (Text(..), empty, firstf, mul, safe, text) @@ -237,6 +241,9 @@ #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as Exts #endif +#if MIN_VERSION_base(4,7,0) +import Text.Printf (PrintfArg, formatArg, formatString) +#endif -- $strict -- @@ -325,9 +332,21 @@ instance Read Text where readsPrec p str = [(pack x,y) | (x,y) <- readsPrec p str] +#if MIN_VERSION_base(4,9,0) +-- Semigroup orphan instances for older GHCs are provided by +-- 'semigroups` package + +instance Semigroup Text where + (<>) = append +#endif + instance Monoid Text where mempty = empty +#if MIN_VERSION_base(4,9,0) + mappend = (<>) -- future-proof definition +#else mappend = append +#endif mconcat = concat instance IsString Text where @@ -346,7 +365,11 @@ instance Binary Text where put t = put (encodeUtf8 t) - get = P.fmap decodeUtf8 get + get = do + bs <- get + case decodeUtf8' bs of + P.Left exn -> P.fail (P.show exn) + P.Right a -> P.return a -- | This instance preserves data abstraction at the cost of inefficiency. -- We omit reflection services for the sake of data abstraction. @@ -371,6 +394,12 @@ _ -> P.error "gunfold" dataTypeOf _ = textDataType +#if MIN_VERSION_base(4,7,0) +-- | Only defined for @base-4.7.0.0@ and later +instance PrintfArg Text where + formatArg txt = formatString $ unpack txt +#endif + packConstr :: Constr packConstr = mkConstr textDataType "pack" [] Prefix @@ -456,8 +485,8 @@ uncons :: Text -> Maybe (Char, Text) uncons t@(Text arr off len) | len <= 0 = Nothing - | otherwise = Just (c, text arr (off+d) (len-d)) - where Iter c d = iter t 0 + | otherwise = Just $ let !(Iter c d) = iter t 0 + in (c, text arr (off+d) (len-d)) {-# INLINE [1] uncons #-} -- | Lifted from Control.Arrow and specialized. @@ -883,13 +912,13 @@ {-# INLINE concatMap #-} -- | /O(n)/ 'any' @p@ @t@ determines whether any character in the --- 'Text' @t@ satisifes the predicate @p@. Subject to fusion. +-- 'Text' @t@ satisfies the predicate @p@. Subject to fusion. any :: (Char -> Bool) -> Text -> Bool any p t = S.any p (stream t) {-# INLINE any #-} -- | /O(n)/ 'all' @p@ @t@ determines whether all characters in the --- 'Text' @t@ satisify the predicate @p@. Subject to fusion. +-- 'Text' @t@ satisfy the predicate @p@. Subject to fusion. all :: (Char -> Bool) -> Text -> Bool all p t = S.all p (stream t) {-# INLINE all #-} @@ -1120,6 +1149,27 @@ unstream (S.takeWhile p (stream t)) = takeWhile p t #-} +-- | /O(n)/ 'takeWhileEnd', applied to a predicate @p@ and a 'Text', +-- returns the longest suffix (possibly empty) of elements that +-- satisfy @p@. Subject to fusion. +-- Examples: +-- +-- > takeWhileEnd (=='o') "foo" == "oo" +takeWhileEnd :: (Char -> Bool) -> Text -> Text +takeWhileEnd p t@(Text arr off len) = loop (len-1) len + where loop !i !l | l <= 0 = t + | p c = loop (i+d) (l+d) + | otherwise = text arr (off+l) (len-l) + where (c,d) = reverseIter t i +{-# INLINE [1] takeWhileEnd #-} + +{-# RULES +"TEXT takeWhileEnd -> fused" [~1] forall p t. + takeWhileEnd p t = S.reverse (S.takeWhile p (S.reverseStream t)) +"TEXT takeWhileEnd -> unfused" [1] forall p t. + S.reverse (S.takeWhile p (S.reverseStream t)) = takeWhileEnd p t + #-} + -- | /O(n)/ 'dropWhile' @p@ @t@ returns the suffix remaining after -- 'takeWhile' @p@ @t@. Subject to fusion. dropWhile :: (Char -> Bool) -> Text -> Text @@ -1138,8 +1188,9 @@ #-} -- | /O(n)/ 'dropWhileEnd' @p@ @t@ returns the prefix remaining after --- dropping characters that fail the predicate @p@ from the end of +-- dropping characters that satisfy the predicate @p@ from the end of -- @t@. Subject to fusion. +-- -- Examples: -- -- > dropWhileEnd (=='.') "foo..." == "foo" @@ -1159,7 +1210,7 @@ #-} -- | /O(n)/ 'dropAround' @p@ @t@ returns the substring remaining after --- dropping characters that fail the predicate @p@ from both the +-- dropping characters that satisfy the predicate @p@ from both the -- beginning and end of @t@. Subject to fusion. dropAround :: (Char -> Bool) -> Text -> Text dropAround p = dropWhile p . dropWhileEnd p diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/benchmarks/haskell/Benchmarks/Pure.hs new/text-1.2.2.0/benchmarks/haskell/Benchmarks/Pure.hs --- old/text-1.2.1.3/benchmarks/haskell/Benchmarks/Pure.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/benchmarks/haskell/Benchmarks/Pure.hs 2015-12-22 21:38:36.000000000 +0100 @@ -262,6 +262,13 @@ , benchBSL $ nf (BL.map toUpper) bla , benchS $ nf (L.map toUpper) sa ] + , bgroup "uncons" + [ benchT $ nf T.uncons ta + , benchTL $ nf TL.uncons tla + , benchBS $ nf BS.uncons bsa + , benchBSL $ nf BL.uncons bla + , benchS $ nf L.uncons sa + ] , bgroup "words" [ benchT $ nf T.words ta , benchTL $ nf TL.words tla diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/benchmarks/haskell/Benchmarks/ReadNumbers.hs new/text-1.2.2.0/benchmarks/haskell/Benchmarks/ReadNumbers.hs --- old/text-1.2.1.3/benchmarks/haskell/Benchmarks/ReadNumbers.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/benchmarks/haskell/Benchmarks/ReadNumbers.hs 2015-12-22 21:38:36.000000000 +0100 @@ -25,8 +25,7 @@ import Numeric (readDec, readFloat, readHex) import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Lazy.Char8 as BL -import qualified Data.ByteString.Lex.Double as B -import qualified Data.ByteString.Lex.Lazy.Double as BL +import qualified Data.ByteString.Lex.Fractional as B import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.Text.Lazy as TL @@ -63,12 +62,10 @@ whnf (double . text TL.rational) tl , bench "DecimalByteString" $ whnf (int . byteString B.readInt) b - , bench "DoubleByteString" $ whnf (double . byteString B.readDouble) b + , bench "DoubleByteString" $ whnf (double . byteString B.readDecimal) b , bench "DecimalLazyByteString" $ whnf (int . byteString BL.readInt) bl - , bench "DoubleLazyByteString" $ - whnf (double . byteString BL.readDouble) bl ] where -- Used for fixing types diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/benchmarks/text-benchmarks.cabal new/text-1.2.2.0/benchmarks/text-benchmarks.cabal --- old/text-1.2.1.3/benchmarks/text-benchmarks.cabal 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/benchmarks/text-benchmarks.cabal 2015-12-22 21:38:36.000000000 +0100 @@ -34,7 +34,7 @@ binary, blaze-builder, bytestring, - bytestring-lexing, + bytestring-lexing >= 0.5.0, containers, criterion >= 0.10.0.0, deepseq, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/changelog.md new/text-1.2.2.0/changelog.md --- old/text-1.2.1.3/changelog.md 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/changelog.md 2015-12-22 21:38:36.000000000 +0100 @@ -1,6 +1,22 @@ +1.2.2.0 + +* The `integer-simple` package, upon which this package optionally + depended, has been replaced with `integer-pure`. The build flag has + been renamed accordingly. + +* Bug fix: For the `Binary` instance, If UTF-8 decoding fails during a + `get`, the error is propagated via `fail` instead of an uncatchable + crash. + +* New function: `takeWhileEnd` + +* New instances for the `Text` types: + * if `base` >= 4.7: `PrintfArg` + * if `base` >= 4.9: `Semigroup` + 1.2.1.3 -* Bug fix: As it turns out, moving the literal rewrite rules to simplifier +* Bug fix: As it turns out, moving the literal rewrite rules to simplifier phase 2 does not prevent competition with the `unpack` rule, which is also active in this phase. Unfortunately this was hidden due to a silly test environment mistake. Moving literal rules back to phase 1 finally diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/tests/Tests/Properties.hs new/text-1.2.2.0/tests/Tests/Properties.hs --- old/text-1.2.1.3/tests/Tests/Properties.hs 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/tests/Tests/Properties.hs 2015-12-22 21:38:36.000000000 +0100 @@ -516,6 +516,10 @@ (unpackS . S.takeWhile p . S.filter q) t_takeWhile p = L.takeWhile p `eqP` (unpackS . T.takeWhile p) tl_takeWhile p = L.takeWhile p `eqP` (unpackS . TL.takeWhile p) +t_takeWhileEnd p = (L.reverse . L.takeWhile p . L.reverse) `eqP` + (unpackS . T.takeWhileEnd p) +tl_takeWhileEnd p = (L.reverse . L.takeWhile p . L.reverse) `eqP` + (unpackS . TL.takeWhileEnd p) s_dropWhile p = L.dropWhile p `eqP` (unpackS . S.dropWhile p) s_dropWhile_s p = L.dropWhile p `eqP` (unpackS . S.unstream . S.dropWhile p) sf_dropWhile q p = (L.dropWhile p . L.filter q) `eqP` @@ -1142,6 +1146,8 @@ testProperty "sf_takeWhile" sf_takeWhile, testProperty "t_takeWhile" t_takeWhile, testProperty "tl_takeWhile" tl_takeWhile, + testProperty "t_takeWhileEnd" t_takeWhileEnd, + testProperty "tl_takeWhileEnd" tl_takeWhileEnd, testProperty "sf_dropWhile" sf_dropWhile, testProperty "s_dropWhile" s_dropWhile, testProperty "s_dropWhile_s" s_dropWhile_s, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/text-1.2.1.3/text.cabal new/text-1.2.2.0/text.cabal --- old/text-1.2.1.3/text.cabal 2015-07-30 13:25:03.000000000 +0200 +++ new/text-1.2.2.0/text.cabal 2015-12-22 21:38:36.000000000 +0100 @@ -1,5 +1,5 @@ name: text -version: 1.2.1.3 +version: 1.2.2.0 homepage: https://github.com/bos/text bug-reports: https://github.com/bos/text/issues synopsis: An efficient packed Unicode text type. @@ -69,8 +69,10 @@ default: False manual: True -flag integer-simple - description: Use the simple integer library instead of GMP +flag integer-pure + description: Use the pure-Haskell integer library instead of GMP + default: False + manual: True library c-sources: cbits/cbits.c @@ -143,9 +145,9 @@ ghc-options: -Werror cpp-options: -DASSERTS - if flag(integer-simple) - cpp-options: -DINTEGER_SIMPLE - build-depends: integer-simple >= 0.1 && < 0.5 + if flag(integer-pure) + cpp-options: -DINTEGER_PURE + build-depends: integer-pure >= 1.0 else cpp-options: -DINTEGER_GMP build-depends: integer-gmp >= 0.2 @@ -179,9 +181,9 @@ test-framework-hunit >= 0.2, test-framework-quickcheck2 >= 0.2 - if flag(integer-simple) - cpp-options: -DINTEGER_SIMPLE - build-depends: integer-simple >= 0.1 && < 0.5 + if flag(integer-pure) + cpp-options: -DINTEGER_PURE + build-depends: integer-pure >= 0.1 && < 0.5 else cpp-options: -DINTEGER_GMP build-depends: integer-gmp >= 0.2