@@ -150,8 +150,8 @@ module Data.Text
150150
151151 -- * Searching
152152 , filter
153+ , breakOnAll
153154 , find
154− , findBy
155155 , partitionBy
156156
157157 -- , findSubstring
@@ -1136,12 +1136,12 @@ chunksOf k = go
11361136-------------------------------------------------------------------------------
11371137-- ** Searching with a predicate
11381138
1139−-- | /O(n)/ The 'findBy' function takes a predicate and a 'Text', and
1140−-- returns the first element in matching the predicate, or 'Nothing'
1141−-- if there is no such element.
1142−findBy :: (Char -> Bool) -> Text -> Maybe Char
1143−findBy p t = S.findBy p (stream t)
1144−{-# INLINE findBy #-}
1139+-- | /O(n)/ The 'find' function takes a predicate and a 'Text', and
1140+-- returns the first element matching the predicate, or 'Nothing' if
1141+-- there is no such element.
1142+find :: (Char -> Bool) -> Text -> Maybe Char
1143+find p t = S.findBy p (stream t)
1144+{-# INLINE find #-}
11451145
11461146-- | /O(n)/ The 'partitionBy' function takes a predicate and a 'Text',
11471147-- and returns the pair of 'Text's with elements which do and do not
@@ -1175,7 +1175,7 @@ filter p t = unstream (S.filter p (stream t))
11751175-- > where (prefix, match) = breakOn needle haystack
11761176--
11771177-- If you need to break a string by a substring repeatedly (e.g. you
1178−-- want to break on every instance of a substring), use 'find'
1178+-- want to break on every instance of a substring), use 'breakOnAll'
11791179-- instead, as it has lower startup overhead.
11801180--
11811181-- In (unlikely) bad cases, this function's time complexity degrades
@@ -1219,16 +1219,16 @@ breakOnEnd pat src = (reverse b, reverse a)
12191219-- towards /O(n*m)/.
12201220--
12211221-- The @needle@ parameter may not be empty.
1222−find :: Text -- ^ @needle@ to search for
1223− -> Text -- ^ @haystack@ in which to search
1224− -> [(Text, Text)]
1225−find pat src@(Text arr off slen)
1226− | null pat = emptyError "find"
1222+breakOnAll :: Text -- ^ @needle@ to search for
1223+ -> Text -- ^ @haystack@ in which to search
1224+ -> [(Text, Text)]
1225+breakOnAll pat src@(Text arr off slen)
1226+ | null pat = emptyError "breakOnAll"
12271227 | otherwise = L.map step (indices pat src)
12281228 where
12291229 step x = (chunk 0 x, chunk x (slen-x))
12301230 chunk !n !l = textP arr (n+off) l
1231−{-# INLINE find #-}
1231+{-# INLINE breakOnAll #-}
12321232
12331233-------------------------------------------------------------------------------
12341234-- ** Indexing 'Text's