@@ -507,22 +507,41 @@ sliceSepWith _cond = undefined -- K.toParserK . D.sliceSepBy cond
507507
508508-- | Collect stream elements until an elements passes the predicate, return the
509509-- 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
511−-- stream and we continue collecting. The succeeding element is treated as a
512−-- prefix separator which is kept in the output segement.
510+-- the predicate succeeds on the first element itself then the parser does not
511+-- terminate there. The succeeding element in the leading position
512+-- is treated as a prefix separator which is kept in the output segment.
513513--
514514-- * Stops - when the predicate succeeds in non-leading position.
515515-- * Fails - never.
516516--
517517-- S.splitWithPrefix pred f = S.parseMany (PR.sliceBeginWith pred f)
518518--
519−-- /Unimplemented/
519+-- Examples: -
520+--
521+-- @
522+-- sliceBeginWithOdd ls = S.parse prsr (S.fromList ls)
523+-- where prsr = P.sliceBeginWith odd FL.toList
524+-- @
525+--
526+-- >>> sliceBeginWithOdd [2, 4, 6, 3]
527+-- > [2,4,6]
528+--
529+-- >>> sliceBeginWithOdd [3, 5, 7, 4]
530+-- > [3]
531+--
532+-- >>> sliceBeginWithOdd [3, 4, 6, 8, 5]
533+-- > [3,4,6,8]
534+--
535+-- >>> sliceBeginWithOdd []
536+-- > []
537+--
538+-- /Internal/
520539--
521540{-# INLINABLE sliceBeginWith #-}
522541sliceBeginWith ::
523− -- Monad m =>
542+ MonadCatch m =>
524543 (a -> Bool) -> Fold m a b -> Parser m a b
525−sliceBeginWith = undefined
544+sliceBeginWith cond = K.toParserK . D.sliceBeginWith cond
526545
527546-- | Like 'sliceSepBy' but the separator elements can be escaped using an
528547-- escape char determined by the second predicate.