@@ -605,7 +605,7 @@ isSingleton = S.isSingleton . stream
605
605
-- Subject to fusion.
606
606
length :: Text -> Int
607
607
length t = S. length (stream t)
608
- {-# INLINE [0 ] length #-}
608
+ {-# INLINE [1 ] length #-}
609
609
-- length needs to be phased after the compareN/length rules otherwise
610
610
-- it may inline before the rules have an opportunity to fire.
611
611
@@ -702,7 +702,7 @@ intersperse c t = unstream (S.intersperse (safe c) (stream t))
702
702
-- >>> T.reverse "desrever"
703
703
-- "reversed"
704
704
--
705
- -- Subject to fusion.
705
+ -- Subject to fusion (fuses with its argument) .
706
706
reverse :: Text -> Text
707
707
reverse t = S. reverse (stream t)
708
708
{-# INLINE reverse #-}
@@ -1033,8 +1033,7 @@ scanl f z t = unstream (S.scanl g z (stream t))
1033
1033
{-# INLINE scanl #-}
1034
1034
1035
1035
-- | /O(n)/ 'scanl1' is a variant of 'scanl' that has no starting
1036
- -- value argument. Subject to fusion. Performs replacement on
1037
- -- invalid scalar values.
1036
+ -- value argument. Performs replacement on invalid scalar values.
1038
1037
--
1039
1038
-- > scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]
1040
1039
scanl1 :: (Char -> Char -> Char ) -> Text -> Text
@@ -1052,8 +1051,7 @@ scanr f z = S.reverse . S.reverseScanr g z . reverseStream
1052
1051
{-# INLINE scanr #-}
1053
1052
1054
1053
-- | /O(n)/ 'scanr1' is a variant of 'scanr' that has no starting
1055
- -- value argument. Subject to fusion. Performs replacement on
1056
- -- invalid scalar values.
1054
+ -- value argument. Performs replacement on invalid scalar values.
1057
1055
scanr1 :: (Char -> Char -> Char ) -> Text -> Text
1058
1056
scanr1 f t | null t = empty
1059
1057
| otherwise = scanr f (last t) (init t)
@@ -1237,7 +1235,7 @@ takeWhile p t@(Text arr off len) = loop 0
1237
1235
1238
1236
-- | /O(n)/ 'takeWhileEnd', applied to a predicate @p@ and a 'Text',
1239
1237
-- returns the longest suffix (possibly empty) of elements that
1240
- -- satisfy @p@. Subject to fusion.
1238
+ -- satisfy @p@.
1241
1239
-- Examples:
1242
1240
--
1243
1241
-- >>> takeWhileEnd (=='o') "foo"
@@ -1252,13 +1250,6 @@ takeWhileEnd p t@(Text arr off len) = loop (len-1) len
1252
1250
where (c,d) = reverseIter t i
1253
1251
{-# INLINE [1] takeWhileEnd #-}
1254
1252
1255
- {-# RULES
1256
- "TEXT takeWhileEnd -> fused" [~1] forall p t.
1257
- takeWhileEnd p t = S.reverse (S.takeWhile p (S.reverseStream t))
1258
- "TEXT takeWhileEnd -> unfused" [1] forall p t.
1259
- S.reverse (S.takeWhile p (S.reverseStream t)) = takeWhileEnd p t
1260
- #-}
1261
-
1262
1253
-- | /O(n)/ 'dropWhile' @p@ @t@ returns the suffix remaining after
1263
1254
-- 'takeWhile' @p@ @t@. Subject to fusion.
1264
1255
dropWhile :: (Char -> Bool ) -> Text -> Text
@@ -1278,7 +1269,7 @@ dropWhile p t@(Text arr off len) = loop 0 0
1278
1269
1279
1270
-- | /O(n)/ 'dropWhileEnd' @p@ @t@ returns the prefix remaining after
1280
1271
-- dropping characters that satisfy the predicate @p@ from the end of
1281
- -- @t@. Subject to fusion.
1272
+ -- @t@.
1282
1273
--
1283
1274
-- Examples:
1284
1275
--
@@ -1292,13 +1283,6 @@ dropWhileEnd p t@(Text arr off len) = loop (len-1) len
1292
1283
where (c,d) = reverseIter t i
1293
1284
{-# INLINE [1] dropWhileEnd #-}
1294
1285
1295
- {-# RULES
1296
- "TEXT dropWhileEnd -> fused" [~1] forall p t.
1297
- dropWhileEnd p t = S.reverse (S.dropWhile p (S.reverseStream t))
1298
- "TEXT dropWhileEnd -> unfused" [1] forall p t.
1299
- S.reverse (S.dropWhile p (S.reverseStream t)) = dropWhileEnd p t
1300
- #-}
1301
-
1302
1286
-- | /O(n)/ 'dropAround' @p@ @t@ returns the substring remaining after
1303
1287
-- dropping characters that satisfy the predicate @p@ from both the
1304
1288
-- beginning and end of @t@. Subject to fusion.
@@ -1311,7 +1295,7 @@ dropAround p = dropWhile p . dropWhileEnd p
1311
1295
-- > dropWhile isSpace
1312
1296
stripStart :: Text -> Text
1313
1297
stripStart = dropWhile isSpace
1314
- {-# INLINE [1] stripStart #-}
1298
+ {-# INLINE stripStart #-}
1315
1299
1316
1300
-- | /O(n)/ Remove trailing white space from a string. Equivalent to:
1317
1301
--
@@ -1482,7 +1466,7 @@ chunksOf k = go
1482
1466
1483
1467
-- | /O(n)/ The 'find' function takes a predicate and a 'Text', and
1484
1468
-- returns the first element matching the predicate, or 'Nothing' if
1485
- -- there is no such element.
1469
+ -- there is no such element. Subject to fusion.
1486
1470
find :: (Char -> Bool ) -> Text -> Maybe Char
1487
1471
find p t = S. findBy p (stream t)
1488
1472
{-# INLINE find #-}
@@ -1598,7 +1582,7 @@ breakOnAll pat src@(Text arr off slen)
1598
1582
-- searching for the index of @\"::\"@ and taking the substrings
1599
1583
-- before and after that index, you would instead use @breakOnAll \"::\"@.
1600
1584
1601
- -- | /O(n)/ 'Text' index (subscript) operator, starting from 0.
1585
+ -- | /O(n)/ 'Text' index (subscript) operator, starting from 0. Subject to fusion.
1602
1586
index :: Text -> Int -> Char
1603
1587
index t n = S. index (stream t) n
1604
1588
{-# INLINE index #-}
0 commit comments