on master help sign in
Rename find to findBy, and findAll to find.

--HG-- extra : convert_revision : 1a7f4b3748721c1e2343db797b0df9310e5faaaf

commit0401b670f433c3a91f4d308a6d9eaa1fe26bd02c authorBryan O'Sullivan <bos@serpentine.com> dateTue 6 Oct 2009, 17:18 (17 years ago) parent710ae28
4 files changed+19−19
Data/Text.hs+2−2 Data/Text/Fusion/Common.hs+5−5 Data/Text/Lazy.hs+6−6 tests/Properties.hs+6−6
Data/Text.hs+2−2
@@ -1066,10 +1066,10 @@ filter p t = unstream (S.filter p (stream t))
10661066-- Laws:
10671067--
10681068-- > concat (prefix : matches) == haystack
1069−-- > where (prefix, matches) = findAll needle haystack
1069+-- > where (prefix, matches) = find needle haystack
10701070find :: Text -> Text -> (Text, [Text])
10711071find pat@(Text _ _ plen) src@(Text sarr soff slen)
1072− | plen <= 0 = emptyError "findAll"
1072+ | plen <= 0 = emptyError "find"
10731073 | otherwise = (h,t)
10741074 where
10751075 (h:t) = go 0 (search 0)
Data/Text/Fusion/Common.hs+5−5
@@ -88,7 +88,7 @@ module Data.Text.Fusion.Common
8888 , filter
8989
9090 -- * Indexing
91− , find
91+ , findBy
9292 , indexI
9393 , findIndexI
9494 , findIndicesI
@@ -729,19 +729,19 @@ elem w (Stream next s0 _len) = loop_elem s0
729729-------------------------------------------------------------------------------
730730-- ** Searching with a predicate
731731
732−-- | /O(n)/ The 'find' function takes a predicate and a stream,
732+-- | /O(n)/ The 'findBy' function takes a predicate and a stream,
733733-- and returns the first element in matching the predicate, or 'Nothing'
734734-- if there is no such element.
735735
736−find :: (Char -> Bool) -> Stream Char -> Maybe Char
737−find p (Stream next s0 _len) = loop_find s0
736+findBy :: (Char -> Bool) -> Stream Char -> Maybe Char
737+findBy p (Stream next s0 _len) = loop_find s0
738738 where
739739 loop_find !s = case next s of
740740 Done -> Nothing
741741 Skip s' -> loop_find s'
742742 Yield x s' | p x -> Just x
743743 | otherwise -> loop_find s'
744−{-# INLINE [0] find #-}
744+{-# INLINE [0] findBy #-}
745745
746746-- | /O(n)/ Stream index (subscript) operator, starting from 0.
747747indexI :: Integral a => Stream Char -> a -> Char
Data/Text/Lazy.hs+6−6
@@ -148,7 +148,7 @@ module Data.Text.Lazy
148148 -- * Searching
149149 , elem
150150 , filter
151− , find
151+ , findBy
152152 , partition
153153
154154 -- , findSubstring
@@ -1064,12 +1064,12 @@ filter :: (Char -> Bool) -> Text -> Text
10641064filter p t = unstream (S.filter p (stream t))
10651065{-# INLINE filter #-}
10661066
1067−-- | /O(n)/ The 'find' function takes a predicate and a 'Text',
1068−-- and returns the first element in matching the predicate, or 'Nothing'
1067+-- | /O(n)/ The 'findBy' function takes a predicate and a 'Text', and
1068+-- returns the first element in matching the predicate, or 'Nothing'
10691069-- if there is no such element.
1070−find :: (Char -> Bool) -> Text -> Maybe Char
1071−find p t = S.find p (stream t)
1072−{-# INLINE find #-}
1070+findBy :: (Char -> Bool) -> Text -> Maybe Char
1071+findBy p t = S.findBy p (stream t)
1072+{-# INLINE findBy #-}
10731073
10741074-- | /O(n)/ The 'partition' function takes a predicate and a 'Text',
10751075-- and returns the pair of 'Text's with elements which do and do not
tests/Properties.hs+6−6
@@ -474,9 +474,9 @@ tl_elem c = L.elem c `eqP` TL.elem c
474474sf_filter q p = (L.filter p . L.filter q) `eqP` (unpackS . S.filter p . S.filter q)
475475t_filter p = L.filter p `eqP` (unpackS . T.filter p)
476476tl_filter p = L.filter p `eqP` (unpackS . TL.filter p)
477−sf_find q p = (L.find p . L.filter q) `eqP` (S.find p . S.filter q)
478−t_find p = L.find p `eqP` T.find p
479−tl_find p = L.find p `eqP` TL.find p
477+sf_findBy q p = (L.find p . L.filter q) `eqP` (S.findBy p . S.filter q)
478+t_findBy p = L.find p `eqP` T.findBy p
479+tl_findBy p = L.find p `eqP` TL.findBy p
480480t_partition p = L.partition p `eqP` (unpack2 . T.partition p)
481481tl_partition p = L.partition p `eqP` (unpack2 . TL.partition p)
482482
@@ -853,9 +853,9 @@ tests = [
853853 testProperty "sf_filter" sf_filter,
854854 testProperty "t_filter" t_filter,
855855 testProperty "tl_filter" tl_filter,
856− testProperty "sf_find" sf_find,
857− testProperty "t_find" t_find,
858− testProperty "tl_find" tl_find,
856+ testProperty "sf_findBy" sf_findBy,
857+ testProperty "t_findBy" t_findBy,
858+ testProperty "tl_findBy" tl_findBy,
859859 testProperty "t_partition" t_partition,
860860 testProperty "tl_partition" tl_partition
861861 ],