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