satisfy :: (Char -> Bool) -> Parser Char
satisfy p = do
  s <- liftP S.get
  case B.uncons s of
    Nothing ->
      E.throwError EndOfInput

    Just (c, s')
      | p c ->
        liftP (S.put s') >> return c
      | otherwise ->
        E.throwError (Chatty $ "invalid character: '" ++ B.unpack s ++ "'")
satisfy :: (Char -> Bool) -> Parser Char
satisfy p = do
  s <- liftP S.get
  case B.uncons s of
    Nothing ->
      E.throwError EndOfInput

    Just (c, s')
      | p c ->
        liftP (S.put s') >> return c
      | otherwise ->
        E.throwError (Chatty $ "invalid character: '" ++ B.unpack s ++ "'")
satisfy p = do
  s <- liftP S.get
  case B.uncons s of
    Nothing ->
      E.throwError EndOfInput

    Just (c, s')
      | p c ->
        liftP (S.put s') >> return c
      | otherwise ->
        E.throwError (Chatty $ "invalid character: '" ++ B.unpack s ++ "'")