on master help sign in
Documentation fix for breakOnAll.
3f108e1John Chee
Data/Text.hs+3−3
@@ -1277,9 +1277,9 @@ breakOnEnd pat src = (reverse b, reverse a)
1277--
1277--
1278-- Examples:
1278-- Examples:
1279--
1279--
1280−-- > find "::" ""
1280+-- > breakOnAll "::" ""
1281-- > ==> []
1281-- > ==> []
1282−-- > find "/" "a/b/c/"
1282+-- > breakOnAll "/" "a/b/c/"
1283-- > ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]
1283-- > ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]
1284--
1284--
1285-- In (unlikely) bad cases, this function's time complexity degrades
1285-- In (unlikely) bad cases, this function's time complexity degrades
@@ -1314,7 +1314,7 @@ breakOnAll pat src@(Text arr off slen)
1314-- For example, suppose you have a string that you want to split on
1314-- For example, suppose you have a string that you want to split on
1315-- the substring @\"::\"@, such as @\"foo::bar::quux\"@. Instead of
1315-- the substring @\"::\"@, such as @\"foo::bar::quux\"@. Instead of
1316-- searching for the index of @\"::\"@ and taking the substrings
1316-- searching for the index of @\"::\"@ and taking the substrings
1317−-- before and after that index, you would instead use @find \"::\"@.
1317+-- before and after that index, you would instead use @breakOnAll \"::\"@.
1318
1318
1319-- | /O(n)/ 'Text' index (subscript) operator, starting from 0.
1319-- | /O(n)/ 'Text' index (subscript) operator, starting from 0.
1320index :: Text -> Int -> Char
1320index :: 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