on master help sign in
Add a review suggestion as comments
commit85afed594389ae87ab082b9a00cba407fe0315e7 authorAdithya Kumar <adithya@composewell.com> dateWed 4 Aug 2021, 20:16 (5 years ago) parent00240ed
1 file changed+8
src/Streamly/Internal/Data/Parser/ParserD.hs+8
src/Streamly/Internal/Data/Parser/ParserD.hs+8
@@ -851,6 +851,14 @@ takeP lim (Parser pstep pinitial pextract) = Parser step initial extract
851851 -- XXX This should error out?
852852 -- If designed properly, this will probably error out.
853853 -- "pextract" should error out
854+ --
855+ -- By Harendra,
856+ --
857+ -- This is a tricky case, we have the following options:
858+ -- 1. Done 0 with extract as you have written
859+ -- 2. Done n, will require buffering elements
860+ -- 3. Use a backtracking fold and not a parser, once we have
861+ -- backtracking in folds
854862 else Done 0 <$> pextract s
855863 Partial n s -> do
856864 let taken = cnt1 - n