# HG changeset patch
# User Bryan O'Sullivan
# Date 1254866257 0
# Node ID 21cf0793a84d8df2a3535be2cec4451360e40f19
# Parent d3631d7390c60ed15a0674705f238ba9444403e4
Remove splitTimesEnd.
diff git a/Data/Text.hs b/Data/Text.hs
 a/Data/Text.hs
+++ b/Data/Text.hs
@@ 125,7 +125,6 @@
 ** Breaking into many substrings
 $split
, split
 , splitTimesEnd
, splitBy
, chunksOf
@@ 933,58 +932,6 @@
split (singleton c) t = splitBy (==c) t
#}
  /O(m+n)/ Break a 'Text' into pieces at most @k@ times,
 treating the first 'Text' argument as the delimiter to break on,
 and consuming the delimiter. The last element of the list contains
 the remaining text after the number of times to split has been
 reached. A value of zero or less for @k@ causes no splitting to
 occur. An empty delimiter is invalid, and will cause an error to be
 raised.

 Examples:

 > splitTimes 0 "//" "a//b//c" == ["a//b//c"]
 > splitTimes 2 ":" "a:b:c:d:e" == ["a","b","c:d:e"]
 > splitTimes 100 "???" "a????b" == ["a","?b"]

 and

 > intercalate s . splitTimes k s == id

 In (unlikely) bad cases, this function's time complexity
 degenerates towards /O(n*m)/.
splitTimes :: Int  ^ Maximum number of times to split
 > Text  ^ Text to split on
 > Text  ^ Input text
 > [Text]
splitTimes k pat@(Text _ _ l) src@(Text arr off len)
  l <= 0 = emptyError "splitTimes"
  otherwise = go 0 0 (indices pat src)
 where
 go !s !i _  i >= k = [textP arr (s+off) (lens)]
 go !s _ [] = [textP arr (s+off) (lens)]
 go !s !i (x:xs) = textP arr (s+off) (xs) : go (x+l) (i+1) xs
{# INLINE splitTimes #}

  /O(m+n)/ Break a 'Text' into pieces at most @k@ times, like
 'splitTimes', but start from the end of the input and work towards
 the start.

 Examples:

 > splitTimes 2 "::" "a::b::c::d::e" == ["a","b","c::d::e"]
 > splitTimesEnd 2 "::" "a::b::c::d::e" == ["a::b::c","d","e"]

 In (unlikely) bad cases, this function's time complexity
 degenerates towards /O(n*m)/.
splitTimesEnd :: Int  ^ Maximum number of times to split
 > Text  ^ Text to split on
 > Text  ^ Input text
 > [Text]
splitTimesEnd k pat src =
 L.reverse . L.map reverse $ splitTimes k (reverse pat) (reverse src)
{# INLINE splitTimesEnd #}

  /O(n)/ Splits a 'Text' into components delimited by separators,
 where the predicate returns True for a separator element. The
 resulting components do not contain the separators. Two adjacent
diff git a/tests/Properties.hs b/tests/Properties.hs
 a/tests/Properties.hs
+++ b/tests/Properties.hs
@@ 402,17 +402,12 @@
t_tails = L.tails `eqP` (map unpackS . T.tails)
tl_tails = L.tails `eqP` (map unpackS . TL.tails)
findSplit s t = case T.find s t of
 (x,xs) > x : L.map (T.drop (T.length s) . fst) xs

t_findSplit s = T.split s `eq` findSplit s
+t_findSplit s = T.split s `eq` splitty
+ where splitty t = case T.find s t of
+ (x,xs) > x : L.map (T.drop (T.length s) . fst) xs
t_split_split s = T.split s `eq` Slow.split s
t_split_i (NotEmpty t) = id `eq` (T.intercalate t . T.split t)
tl_split_i (NotEmpty t) = id `eq` (TL.intercalate t . TL.split t)
t_splitTimesEnd_i k (NotEmpty t) = id `eq` (T.intercalate t . T.splitTimesEnd k t)
tl_splitTimesEnd_i k (NotEmpty t) = id `eq` (TL.intercalate t . TL.splitTimesEnd k t)
t_splitTimesEnd_split (NotEmpty t) = T.splitTimesEnd maxBound t `eq` T.split t
tl_splitTimesEnd_split (NotEmpty t) = TL.splitTimesEnd maxBound t `eq` TL.split t
t_splitBy p = splitBy p `eqP` (map unpackS . T.splitBy p)
t_splitBy_count c = (L.length . T.splitBy (==c)) `eq` ((1+) . T.count (T.singleton c))
@@ 791,10 +786,6 @@
testProperty "t_findSplit" t_findSplit,
testProperty "t_split_split" t_split_split,
testProperty "t_split_i" t_split_i,
 testProperty "t_splitTimesEnd_i" t_splitTimesEnd_i,
 testProperty "tl_splitTimesEnd_i" tl_splitTimesEnd_i,
 testProperty "t_splitTimesEnd_split" t_splitTimesEnd_split,
 testProperty "tl_splitTimesEnd_split" tl_splitTimesEnd_split,
testProperty "tl_split_i" tl_split_i,
testProperty "t_splitBy" t_splitBy,
testProperty "t_splitBy_count" t_splitBy_count,