@@ -407,13 +407,14 @@ notWord8 c = satisfy (/= c) <?> "not " ++ show c
407407-- combinators such as 'many', because such parsers loop until a
408408-- failure occurs. Careless use will thus result in an infinite loop.
409409peekWord8 :: Parser (Maybe Word8)
410−peekWord8 = T.Parser $ \i0 a0 m0 _kf ks ->
411− let ks' i a m = let w = B.unsafeHead (unI i)
412− in w `seq` ks i a m (Just w)
413− kf' i a m = ks i a m Nothing
414− in if B.null (unI i0)
415− then prompt i0 a0 m0 kf' ks'
416− else ks' i0 a0 m0
410+peekWord8 = T.Parser $ \i0 a0 m0 _kf ks -> case m0 of
411+ Complete -> ks i0 a0 m0 Nothing
412+ Incomplete -> let ks' i a m = let w = B.unsafeHead (unI i)
413+ in w `seq` ks i a m (Just w)
414+ kf' i a m = ks i a m Nothing
415+ in if B.null (unI i0)
416+ then prompt i0 a0 m0 kf' ks'
417+ else ks' i0 a0 m0
417418{-# INLINE peekWord8 #-}
418419
419420-- | Match only if all input has been consumed.