packages feed

text 1.2.1.3 → 1.2.2.0

raw patch · 17 files changed

+191/−49 lines, 17 filesdep +integer-puredep −integer-simpledep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: integer-pure

Dependencies removed: integer-simple

Dependency ranges changed: base

API changes (from Hackage documentation)

- Data.Text: instance Binary Text
- Data.Text: instance Data Text
- Data.Text: instance Eq Text
- Data.Text: instance IsList Text
- Data.Text: instance IsString Text
- Data.Text: instance Monoid Text
- Data.Text: instance NFData Text
- Data.Text: instance Ord Text
- Data.Text: instance Read Text
- Data.Text.Array: aBA :: Array -> ByteArray#
- Data.Text.Array: maBA :: MArray s -> MutableByteArray# s
- Data.Text.Encoding: instance Eq CodePoint
- Data.Text.Encoding: instance Eq DecoderState
- Data.Text.Encoding: instance Num CodePoint
- Data.Text.Encoding: instance Num DecoderState
- Data.Text.Encoding: instance Show CodePoint
- Data.Text.Encoding: instance Show DecoderState
- Data.Text.Encoding: instance Show Decoding
- Data.Text.Encoding: instance Storable CodePoint
- Data.Text.Encoding: instance Storable DecoderState
- Data.Text.Encoding.Error: instance Eq UnicodeException
- Data.Text.Encoding.Error: instance Exception UnicodeException
- Data.Text.Encoding.Error: instance NFData UnicodeException
- Data.Text.Encoding.Error: instance Show UnicodeException
- Data.Text.Encoding.Error: instance Typeable UnicodeException
- Data.Text.Foreign: instance Bounded I16
- Data.Text.Foreign: instance Enum I16
- Data.Text.Foreign: instance Eq I16
- Data.Text.Foreign: instance Integral I16
- Data.Text.Foreign: instance Num I16
- Data.Text.Foreign: instance Ord I16
- Data.Text.Foreign: instance Read I16
- Data.Text.Foreign: instance Real I16
- Data.Text.Foreign: instance Show I16
- Data.Text.Internal: instance Typeable Text
- Data.Text.Internal.Builder: instance Eq Builder
- Data.Text.Internal.Builder: instance IsString Builder
- Data.Text.Internal.Builder: instance Monoid Builder
- Data.Text.Internal.Builder: instance Ord Builder
- Data.Text.Internal.Builder: instance Show Builder
- Data.Text.Internal.Fusion.Size: instance Eq Size
- Data.Text.Internal.Fusion.Size: instance Num Size
- Data.Text.Internal.Fusion.Size: instance Show Size
- Data.Text.Internal.Fusion.Types: instance Eq a => Eq (Stream a)
- Data.Text.Internal.Fusion.Types: instance Ord a => Ord (Stream a)
- Data.Text.Internal.Lazy: instance Typeable Text
- Data.Text.Internal.Read: instance Applicative (IParser t)
- Data.Text.Internal.Read: instance Functor (IParser t)
- Data.Text.Internal.Read: instance Monad (IParser t)
- Data.Text.Internal.Read: runP :: IParser t a -> IReader t a
- Data.Text.Internal.Unsafe.Shift: instance UnsafeShift Int
- Data.Text.Internal.Unsafe.Shift: instance UnsafeShift Word16
- Data.Text.Internal.Unsafe.Shift: instance UnsafeShift Word32
- Data.Text.Internal.Unsafe.Shift: instance UnsafeShift Word64
- Data.Text.Lazy: instance Binary Text
- Data.Text.Lazy: instance Data Text
- Data.Text.Lazy: instance Eq Text
- Data.Text.Lazy: instance IsList Text
- Data.Text.Lazy: instance IsString Text
- Data.Text.Lazy: instance Monoid Text
- Data.Text.Lazy: instance NFData Text
- Data.Text.Lazy: instance Ord Text
- Data.Text.Lazy: instance Read Text
- Data.Text.Lazy: instance Show Text
- Data.Text.Lazy.Builder.RealFloat: instance Enum FPFormat
- Data.Text.Lazy.Builder.RealFloat: instance Read FPFormat
- Data.Text.Lazy.Builder.RealFloat: instance Show FPFormat
+ Data.Text: instance Control.DeepSeq.NFData Data.Text.Internal.Text
+ Data.Text: instance Data.Binary.Class.Binary Data.Text.Internal.Text
+ Data.Text: instance Data.Data.Data Data.Text.Internal.Text
+ Data.Text: instance Data.String.IsString Data.Text.Internal.Text
+ Data.Text: instance GHC.Base.Monoid Data.Text.Internal.Text
+ Data.Text: instance GHC.Classes.Eq Data.Text.Internal.Text
+ Data.Text: instance GHC.Classes.Ord Data.Text.Internal.Text
+ Data.Text: instance GHC.Exts.IsList Data.Text.Internal.Text
+ Data.Text: instance GHC.Read.Read Data.Text.Internal.Text
+ Data.Text: instance Text.Printf.PrintfArg Data.Text.Internal.Text
+ Data.Text: takeWhileEnd :: (Char -> Bool) -> Text -> Text
+ Data.Text.Array: [aBA] :: Array -> ByteArray#
+ Data.Text.Array: [maBA] :: MArray s -> MutableByteArray# s
+ Data.Text.Encoding: instance Foreign.Storable.Storable Data.Text.Encoding.CodePoint
+ Data.Text.Encoding: instance Foreign.Storable.Storable Data.Text.Encoding.DecoderState
+ Data.Text.Encoding: instance GHC.Classes.Eq Data.Text.Encoding.CodePoint
+ Data.Text.Encoding: instance GHC.Classes.Eq Data.Text.Encoding.DecoderState
+ Data.Text.Encoding: instance GHC.Num.Num Data.Text.Encoding.CodePoint
+ Data.Text.Encoding: instance GHC.Num.Num Data.Text.Encoding.DecoderState
+ Data.Text.Encoding: instance GHC.Show.Show Data.Text.Encoding.CodePoint
+ Data.Text.Encoding: instance GHC.Show.Show Data.Text.Encoding.DecoderState
+ Data.Text.Encoding: instance GHC.Show.Show Data.Text.Encoding.Decoding
+ Data.Text.Encoding.Error: instance Control.DeepSeq.NFData Data.Text.Encoding.Error.UnicodeException
+ Data.Text.Encoding.Error: instance GHC.Classes.Eq Data.Text.Encoding.Error.UnicodeException
+ Data.Text.Encoding.Error: instance GHC.Exception.Exception Data.Text.Encoding.Error.UnicodeException
+ Data.Text.Encoding.Error: instance GHC.Show.Show Data.Text.Encoding.Error.UnicodeException
+ Data.Text.Foreign: instance GHC.Classes.Eq Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Classes.Ord Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Enum.Bounded Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Enum.Enum Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Num.Num Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Read.Read Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Real.Integral Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Real.Real Data.Text.Foreign.I16
+ Data.Text.Foreign: instance GHC.Show.Show Data.Text.Foreign.I16
+ Data.Text.Internal.Builder: instance Data.String.IsString Data.Text.Internal.Builder.Builder
+ Data.Text.Internal.Builder: instance GHC.Base.Monoid Data.Text.Internal.Builder.Builder
+ Data.Text.Internal.Builder: instance GHC.Classes.Eq Data.Text.Internal.Builder.Builder
+ Data.Text.Internal.Builder: instance GHC.Classes.Ord Data.Text.Internal.Builder.Builder
+ Data.Text.Internal.Builder: instance GHC.Show.Show Data.Text.Internal.Builder.Builder
+ Data.Text.Internal.Fusion.Size: instance GHC.Classes.Eq Data.Text.Internal.Fusion.Size.Size
+ Data.Text.Internal.Fusion.Size: instance GHC.Num.Num Data.Text.Internal.Fusion.Size.Size
+ Data.Text.Internal.Fusion.Size: instance GHC.Show.Show Data.Text.Internal.Fusion.Size.Size
+ Data.Text.Internal.Fusion.Types: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Text.Internal.Fusion.Types.Stream a)
+ Data.Text.Internal.Fusion.Types: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Text.Internal.Fusion.Types.Stream a)
+ Data.Text.Internal.Read: [runP] :: IParser t a -> IReader t a
+ Data.Text.Internal.Read: instance GHC.Base.Applicative (Data.Text.Internal.Read.IParser t)
+ Data.Text.Internal.Read: instance GHC.Base.Functor (Data.Text.Internal.Read.IParser t)
+ Data.Text.Internal.Read: instance GHC.Base.Monad (Data.Text.Internal.Read.IParser t)
+ Data.Text.Internal.Unsafe.Shift: instance Data.Text.Internal.Unsafe.Shift.UnsafeShift GHC.Types.Int
+ Data.Text.Internal.Unsafe.Shift: instance Data.Text.Internal.Unsafe.Shift.UnsafeShift GHC.Word.Word16
+ Data.Text.Internal.Unsafe.Shift: instance Data.Text.Internal.Unsafe.Shift.UnsafeShift GHC.Word.Word32
+ Data.Text.Internal.Unsafe.Shift: instance Data.Text.Internal.Unsafe.Shift.UnsafeShift GHC.Word.Word64
+ Data.Text.Lazy: instance Control.DeepSeq.NFData Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance Data.Binary.Class.Binary Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance Data.Data.Data Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance Data.String.IsString Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance GHC.Base.Monoid Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance GHC.Classes.Eq Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance GHC.Classes.Ord Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance GHC.Exts.IsList Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance GHC.Read.Read Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance GHC.Show.Show Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: instance Text.Printf.PrintfArg Data.Text.Internal.Lazy.Text
+ Data.Text.Lazy: takeWhileEnd :: (Char -> Bool) -> Text -> Text
+ Data.Text.Lazy.Builder.RealFloat: instance GHC.Enum.Enum Data.Text.Lazy.Builder.RealFloat.FPFormat
+ Data.Text.Lazy.Builder.RealFloat: instance GHC.Read.Read Data.Text.Lazy.Builder.RealFloat.FPFormat
+ Data.Text.Lazy.Builder.RealFloat: instance GHC.Show.Show Data.Text.Lazy.Builder.RealFloat.FPFormat
- Data.Text.Internal.Fusion.Common: isPrefixOf :: Eq a => Stream a -> Stream a -> Bool
+ Data.Text.Internal.Fusion.Common: isPrefixOf :: (Eq a) => Stream a -> Stream a -> Bool
- Data.Text.Lazy.Builder.RealFloat: formatRealFloat :: RealFloat a => FPFormat -> Maybe Int -> a -> Builder
+ Data.Text.Lazy.Builder.RealFloat: formatRealFloat :: (RealFloat a) => FPFormat -> Maybe Int -> a -> Builder
- Data.Text.Lazy.Builder.RealFloat: realFloat :: RealFloat a => a -> Builder
+ Data.Text.Lazy.Builder.RealFloat: realFloat :: (RealFloat a) => a -> Builder

Files

Data/Text.hs view
@@ -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
Data/Text/Encoding/Error.hs view
@@ -1,5 +1,7 @@ {-# LANGUAGE CPP, DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ >= 702+#if __GLASGOW_HASKELL__ >= 704+{-# LANGUAGE Safe #-}+#elif __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif -- |
Data/Text/Internal/Builder.hs view
@@ -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
Data/Text/Internal/Builder/Functions.hs view
@@ -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 #-}
Data/Text/Internal/Fusion/Common.hs view
@@ -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
Data/Text/Internal/Read.hs view
@@ -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'
Data/Text/Lazy.hs view
@@ -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
Data/Text/Lazy/Builder/Int.hs view
@@ -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
Data/Text/Lazy/Encoding.hs view
@@ -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
Data/Text/Lazy/Read.hs view
@@ -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 #-}
Data/Text/Read.hs view
@@ -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 #-}
benchmarks/haskell/Benchmarks/Pure.hs view
@@ -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
benchmarks/haskell/Benchmarks/ReadNumbers.hs view
@@ -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
benchmarks/text-benchmarks.cabal view
@@ -34,7 +34,7 @@                   binary,                   blaze-builder,                   bytestring,-                  bytestring-lexing,+                  bytestring-lexing >= 0.5.0,                   containers,                   criterion >= 0.10.0.0,                   deepseq,
changelog.md view
@@ -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
tests/Tests/Properties.hs view
@@ -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,
text.cabal view
@@ -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