I'm reviewing Haskell: The Craft of Functional Programming, however the type signatures on page 356 have thrown me for a loop.
Here is a simple one:
succeed :: b -> Parse a b
succeed val inp = [( val, inp )]
How can that be b -> Parse a b
, if
succeed Int -> Int
succeed a = a
and,
succeed Int -> Int -> Int
succeed a b = a + b
The amount of arguments your taking has to be in the type declaration right? How can you take val
, and imp
, if your type declaration only has one type variable: succeed :: b -> Parse a b
is supposed to read, take one variable of type a
and return a type of Parse a b
, not take two variables... where is inp
permitted?