@@ -553,16 +553,16 @@ eqBy cmp str = Parser step initial extract
553553
554554 initial = return str
555555
556− step [] _ = error "Bug: unreachable"
556+ step [] _ = return $ Stop 0 ()
557557 step [x] a = return $
558558 if x `cmp` a
559559 then Stop 0 ()
560− else Error "eqBy: failed, at the last element"
560+ else Error "eqBy: failed, yet to match the last element"
561561 step (x:xs) a = return $
562562 if x `cmp` a
563563 then Skip 0 xs
564564 else Error $
565− "eqBy: failed, yet to match " ++ show (length xs) ++ " elements"
565+ "eqBy: failed, yet to match " ++ show (length xs + 1) ++ " elements"
566566
567567 extract xs = throwM $ ParseError $
568568 "eqBy: end of input, yet to match " ++ show (length xs) ++ " elements"