The short answer is yes: it's exactly what it means. The last type is the return value, all others are arguments.
This is so for a very simple reason, namely: there's no such thing as multi-agrument function in Haskell. All functions are single-argument in reallity, function's general type being a -> b
. Then we have something looking like multi-parameter functions thanks to currying. All you need to understand this are parentheses:
add :: Integer -> (Integer -> Integer)
Which reads: add
is a function which takes an Integer
and returns a function Integer -> Integer
. All parentheses sqeeze on the right-hand side here. On the contrary, when you apply, all parentheses squeeze on the left hand size, like so:
(add 5) 6
Which reads: apply add
to argument 5
. In return you'll get a function - then apply that function to 6
(the final result being 11
). We could equally well define it like so:
add :: Integer -> (Integer -> Integer)
add x = \y -> x + y
So the fact that you can specify multiple arguments for a function is only a syntactic sugar so that you don't have to return all these lambdas down the road.
This very fact is also why we can do this:
add5 :: Integer -> Integer
add5 = (+5)