I tried to run the following code which is taken from 'Programming in Haskell' by Graham Hutton
type Parser a = [(a, String)]
return :: a -> Parser a
return v = \inp -> [(v,inp)]
when loading the module in GHCI 7.6.3 the following error occurs:
Couldn't match expected type `t0 -> [(a, t0)]'
with actual type `[(a, String)]'
The lambda expression `\ inp -> ...' has one argument,
but its type `Parser a' has none
In the expression: \ inp -> [(v, inp)]
In an equation for `return': return v = \ inp -> [(v, inp)]
Failed, modules loaded: none.
I changed the sample to:
type Parser a = [(a, String)]
return :: a -> String -> Parser a
return v inp = [(v,inp)]
which worked, I'd like to get to run the original sample however and was wondering what I've missed.