Skip to content

Commit

Permalink
plug leak in bind
Browse files Browse the repository at this point in the history
  • Loading branch information
wz1000 authored and phadej committed Nov 19, 2021
1 parent e3d8d57 commit b00129b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Text/Parsec/Prim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ parserBind m k
= ParsecT $ \s cok cerr eok eerr ->
let
-- consumed-okay case for m
mcok x s err =
mcok x s err
| errorIsUnknown err = unParser (k x) s cok cerr cok cerr
| otherwise =
let
-- if (k x) consumes, those go straigt up
pcok = cok
Expand All @@ -335,7 +337,9 @@ parserBind m k
in unParser (k x) s pcok pcerr peok peerr

-- empty-ok case for m
meok x s err =
meok x s err
| errorIsUnknown err = unParser (k x) s cok cerr eok eerr
| otherwise =
let
-- in these cases, (k x) can return as empty
pcok = cok
Expand Down

0 comments on commit b00129b

Please # to comment.