@@ -123,7 +123,7 @@ module Data.Text
126− -- , partition
126+ , partition
128 -- , findSubstring
128 -- , findSubstring
@@ -758,6 +758,15 @@ find :: (Char -> Bool) -> Text -> Maybe Char
758find p t = S.find p (stream t)
758find p t = S.find p (stream t)
759{-# INLINE find #-}
759{-# INLINE find #-}
761+-- | /O(n)/ The 'partition' function takes a predicate and a 'Text',
762+-- and returns the pair of 'Text's with elements which do and do not
763+-- satisfy the predicate, respectively; i.e.
765+-- > partition p t == (filter p t, filter (not . p) t)
766+partition :: (Char -> Bool) -> Text -> (Text, Text)
767+partition p t = (filter p t, filter (not . p) t)
768+{-# INLINE partition #-}
761-- | Break a string on a substring, returning a pair of the part of the
770-- | Break a string on a substring, returning a pair of the part of the
762-- string prior to the match, and the rest of the string.
771-- string prior to the match, and the rest of the string.
@@ -796,6 +805,7 @@ breakSubstring pat src = search 0 src
796 | null s = (src,empty) -- not found
805 | null s = (src,empty) -- not found
797 | pat `isPrefixOf` s = (take n src,s)
806 | pat `isPrefixOf` s = (take n src,s)
798 | otherwise = search (n+1) (tail s)
807 | otherwise = search (n+1) (tail s)
808+{-# INLINE breakSubstring #-}
800-- | /O(n)/ 'filter', applied to a predicate and a 'Text',
810-- | /O(n)/ 'filter', applied to a predicate and a 'Text',
801-- returns a 'Text' containing those characters that satisfy the
811-- returns a 'Text' containing those characters that satisfy the