@@ -507,22 +507,41 @@ sliceSepWith _cond = undefined -- K.toParserK . D.sliceSepBy cond
508-- | Collect stream elements until an elements passes the predicate, return the
508-- | Collect stream elements until an elements passes the predicate, return the
509-- last element on which the predicate succeeded back to the input stream. If
509-- last element on which the predicate succeeded back to the input stream. If
510−-- the predicate succeeds on the first element itself then it is kept in the
510+-- the predicate succeeds on the first element itself then the parser does not
511−-- stream and we continue collecting. The succeeding element is treated as a
511+-- terminate there. The succeeding element in the leading position
512−-- prefix separator which is kept in the output segement.
512+-- is treated as a prefix separator which is kept in the output segment.
514-- * Stops - when the predicate succeeds in non-leading position.
514-- * Stops - when the predicate succeeds in non-leading position.
515-- * Fails - never.
515-- * Fails - never.
517-- S.splitWithPrefix pred f = S.parseMany (PR.sliceBeginWith pred f)
517-- S.splitWithPrefix pred f = S.parseMany (PR.sliceBeginWith pred f)
519−-- /Unimplemented/
519+-- Examples: -
522+-- sliceBeginWithOdd ls = S.parse prsr (S.fromList ls)
523+-- where prsr = P.sliceBeginWith odd FL.toList
526+-- >>> sliceBeginWithOdd [2, 4, 6, 3]
529+-- >>> sliceBeginWithOdd [3, 5, 7, 4]
532+-- >>> sliceBeginWithOdd [3, 4, 6, 8, 5]
535+-- >>> sliceBeginWithOdd []
521{-# INLINABLE sliceBeginWith #-}
540{-# INLINABLE sliceBeginWith #-}
522sliceBeginWith ::
541sliceBeginWith ::
523− -- Monad m =>
542+ MonadCatch m =>
524 (a -> Bool) -> Fold m a b -> Parser m a b
543 (a -> Bool) -> Fold m a b -> Parser m a b
525−sliceBeginWith = undefined
544+sliceBeginWith cond = K.toParserK . D.sliceBeginWith cond
527-- | Like 'sliceSepBy' but the separator elements can be escaped using an
546-- | Like 'sliceSepBy' but the separator elements can be escaped using an
528-- escape char determined by the second predicate.
547-- escape char determined by the second predicate.