@@ -123,7 +123,7 @@ module Data.Text
123123 , elem
124124 , filter
125125 , find
126− -- , partition
126+ , partition
127127
128128 -- , findSubstring
129129
@@ -758,6 +758,15 @@ find :: (Char -> Bool) -> Text -> Maybe Char
758758find p t = S.find p (stream t)
759759{-# INLINE find #-}
760760
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.
764+--
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 #-}
769+
761770-- | Break a string on a substring, returning a pair of the part of the
762771-- string prior to the match, and the rest of the string.
763772--
@@ -796,6 +805,7 @@ breakSubstring pat src = search 0 src
796805 | null s = (src,empty) -- not found
797806 | pat `isPrefixOf` s = (take n src,s)
798807 | otherwise = search (n+1) (tail s)
808+{-# INLINE breakSubstring #-}
799809
800810-- | /O(n)/ 'filter', applied to a predicate and a 'Text',
801811-- returns a 'Text' containing those characters that satisfy the