@@ -145,7 +145,6 @@ module Streamly.Internal.Data.Fold
145145 -- By elements
146146 , sliceSepBy
147147 -- , breakOn
148− , sliceSepByMax
149148 , sliceEndWith
150149 -- , breakAfter
151150 {-
@@ -1044,43 +1043,6 @@ sliceSepBy predicate (Fold fstep finitial fextract) =
10441043 then fstep s a
10451044 else Done <$> fextract s
10461045
1047−-- | Like 'sliceSepBy' but terminates a parse even before the separator
1048−-- is encountered if its size exceeds the specified maximum limit.
1049−--
1050−-- > take n = PR.sliceSepByMax (const True) n
1051−-- > sliceSepBy p = PR.sliceSepByMax p maxBound
1052−--
1053−-- Let's use the following definitions for illustration:
1054−--
1055−-- > splitOn p n = PR.many FL.toList $ PR.sliceSepByMax p n (FL.toList)
1056−-- > splitOn' p n = S.parse (splitOn p n) . S.fromList
1057−--
1058−-- >>> splitOn' (== '.') 0 ""
1059−-- [""]
1060−--
1061−-- >>> splitOn' (== '.') 0 "a"
1062−-- infinite list of empty strings
1063−--
1064−-- >>> splitOn' (== '.') 3 "hello.world"
1065−-- ["hel","lo","wor","ld"]
1066−--
1067−-- If the separator is found and the limit is reached at the same time then it
1068−-- behaves just like 'sliceSepBy' i.e. the separator is dropped.
1069−--
1070−-- >>> splitOn' (== '.') 0 "."
1071−-- ["",""]
1072−--
1073−-- >>> splitOn' (== '.') 0 ".."
1074−-- ["","",""]
1075−--
1076−-- Stops - when the predicate succeeds or the limit is reached.
1077−--
1078−-- /Internal/
1079−{-# INLINABLE sliceSepByMax #-}
1080−sliceSepByMax :: Monad m
1081− => (a -> Bool) -> Int -> Fold m a b -> Fold m a b
1082−sliceSepByMax p n = sliceSepBy p . takeLE n
1083−
10841046-- | Collect stream elements until an element succeeds the predicate. Also take
10851047-- the element on which the predicate succeeded. The succeeding element is
10861048-- treated as a suffix separator which is kept in the output segement.