Hi.

I'm Following the book of Programming in haskell written by Graham Hutton. In Chapter number 8 there is a discussion about functional parsers and it is defined a functional Parser item and some basic parsers as follow


success :: a -> Parser a

success v = \ inp -> [(v,inp)]


failure :: Parser a

failure = \inp -> [ ]


item :: Parser Char

item = \inp -> case inp of

[ ] -> [ ]

(x:xs) -> [(x,xs)]


Based on this parser it is defined a new parser called sat p

sat :: (Char -> Bool ) -> Parser Char

sat p = do x <- item

if p x then success x else failure


as result, this error appears 


Couldn't match expected type `Char'

with actual type `[(Char, String)]'

In the first argument of `p', namely `x'

In the expression: p x

In the expression: if p x then success x else failure


Can you help me ?

Greets,

Felipe