@@ -36,6 +36,7 @@ module Streamly.Internal.Data.Parser.ParserD
3636 -- * Map on input
3737 , lmap
3838 , lmapM
39+ , postscan
3940 , filter
4041
4142 -- * Element parsers
@@ -1459,6 +1460,24 @@ matchBy cmp (D.Stream sstep state) = Parser step initial extract
14591460
14601461 extract _ = throwM $ ParseError "match: end of input"
14611462
1463+-------------------------------------------------------------------------------
1464+-- Transformations on input
1465+-------------------------------------------------------------------------------
1466+
1467+-- Initial needs a "Continue" constructor to implement scans on parsers. As a
1468+-- parser can always return a Continue in initial when we feed the fold's
1469+-- initial result to it. We can work this around for postscan by introducing an
1470+-- initial state and calling "initial" only on the first input.
1471+--
1472+-- | Stateful scan on the input of a parser using a Fold.
1473+--
1474+-- /Unimplemented/
1475+--
1476+{-# INLINE postscan #-}
1477+postscan :: -- Monad m =>
1478+ Fold m a b -> Parser m b c -> Parser m a c
1479+postscan = undefined
1480+
14621481{-# INLINE zipWithM #-}
14631482zipWithM :: MonadThrow m =>
14641483 (a -> b -> m c) -> D.Stream m a -> Fold m c x -> Parser m b x