23 ms·
You don't have to syntactically consume all of arguments of a function to write its body. f :: a -> Int -> Int -> Int f x = (+) There really isn't any
by mikeplus48 14y ago
You don't have to syntactically consume all of arguments of a function to write its body.
f :: a -> Int -> Int -> Int
f x = (+)
There really isn't anything meaningful to do with a function before it has consumed all it's arguments other than returning another function.
> However, this "f" is quite different from a function that has the signature "x->(y->z)"
Yes, we have applied the argument of type 'x'. f 0 is no longer of type "x -> y -> z", or "x -> (y -> z)" (because of -> precedence, the two are equivalent), it is "y -> z".
Currying is explicit.
f x y = foobar
is just short hand for
f = \x -> \y -> foobar