The signature says how you can curry the function, but what I'm saying is that the body of the function is written essentially oblivious to that currying. For example, the body of the function would be written the same if the signature were "x->y->z" or "y->x->z".
If we consider (f 0) this provides an auto-currying of the function. However, this "f" is quite different from a function that has the signature "x->(y->z)" where the body would indeed need to be different (where the currying is explicit).
Re:Can a language be safe?
by mikeplus48 on Monday July 02, 2012 @11:38AM
(#4189289)
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
Function application in Haskell is first class. If you have
then use it like you have a new function: then if you apply again, and this final expression, equivalent to f 0 1, gives you something of type 'z'