Cursor doesn't get advanced input upon successful state predicate match.
So the following will enter an infinite loop instead of parsing the lead "ABCD"
parseBytes (scan 0x41 (\b w -> if b <= w then Just w else Nothing)) (fromString "ABCDABCD")
Possible change:
let go s = do
mw <- peek
case mw of
Nothing -> pure s
Just w -> case t s w of
Just s' -> anyUnsafe >> go s'
Nothing -> pure s'
Cursor doesn't get advanced input upon successful state predicate match.
So the following will enter an infinite loop instead of parsing the lead "ABCD"
parseBytes (scan 0x41 (\b w -> if b <= w then Just w else Nothing)) (fromString "ABCDABCD")Possible change: