@@ -940,10 +940,12 @@ find :: Text -- ^ @needle@ to search for
940 -> [(Text, Text)]
940 -> [(Text, Text)]
941find pat src
941find pat src
942 | null pat = emptyError "find"
942 | null pat = emptyError "find"
943− | otherwise = L.map step (indices pat src)
943+ | otherwise = go 0 empty src (indices pat src)
945− step x = let h :*: t = splitAtWord x src
945+ go !n p s (x:xs) = let h :*: t = splitAtWord (x-n) s
946− in (h, t)
947+ in (h',t) : go x h' t xs
948-- | /O(n)/ 'breakBy' is like 'spanBy', but the prefix returned is over
950-- | /O(n)/ 'breakBy' is like 'spanBy', but the prefix returned is over
949-- elements that fail the predicate @p@.
951-- elements that fail the predicate @p@.