on master help sign in
Merge
3d34324Bryan O'Sullivan
Data/Text.hs+3−3
@@ -1275,9 +1275,9 @@ breakOnEnd pat src = (reverse b, reverse a)
1275--
1275--
1276-- Examples:
1276-- Examples:
1277--
1277--
1278−-- > find "::" ""
1278+-- > breakOnAll "::" ""
1279-- > ==> []
1279-- > ==> []
1280−-- > find "/" "a/b/c/"
1280+-- > breakOnAll "/" "a/b/c/"
1281-- > ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]
1281-- > ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]
1282--
1282--
1283-- In (unlikely) bad cases, this function's time complexity degrades
1283-- In (unlikely) bad cases, this function's time complexity degrades
@@ -1312,7 +1312,7 @@ breakOnAll pat src@(Text arr off slen)
1312-- For example, suppose you have a string that you want to split on
1312-- For example, suppose you have a string that you want to split on
1313-- the substring @\"::\"@, such as @\"foo::bar::quux\"@. Instead of
1313-- the substring @\"::\"@, such as @\"foo::bar::quux\"@. Instead of
1314-- searching for the index of @\"::\"@ and taking the substrings
1314-- searching for the index of @\"::\"@ and taking the substrings
1315−-- before and after that index, you would instead use @find \"::\"@.
1315+-- before and after that index, you would instead use @breakOnAll \"::\"@.
1316
1316
1317-- | /O(n)/ 'Text' index (subscript) operator, starting from 0.
1317-- | /O(n)/ 'Text' index (subscript) operator, starting from 0.
1318index :: Text -> Int -> Char
1318index :: Text -> Int -> Char
Data/Text/Lazy.hs+1−1
@@ -1056,7 +1056,7 @@ splitAtWord x (Chunk c@(T.Text arr off len) cs)
1056-- > where (prefix, match) = breakOn needle haystack
1056-- > where (prefix, match) = breakOn needle haystack
1057--
1057--
1058-- If you need to break a string by a substring repeatedly (e.g. you
1058-- If you need to break a string by a substring repeatedly (e.g. you
1059−-- want to break on every instance of a substring), use 'find'
1059+-- want to break on every instance of a substring), use 'breakOnAll'
1060-- instead, as it has lower startup overhead.
1060-- instead, as it has lower startup overhead.
1061--
1061--
1062-- This function is strict in its first argument, and lazy in its
1062-- This function is strict in its first argument, and lazy in its