3 ms·
You should first understand currying. If I have a function f :: A -> B -> C -> D, every time I apply an argument, as in f a where a is of type A (b :: B, c :: C
by gaze 11y ago
You should first understand currying. If I have a function f :: A -> B -> C -> D, every time I apply an argument, as in f a where a is of type A (b :: B, c :: C, ...), you get a new function back of type B -> C -> D. Read :: as "has type." Therefore
f :: A -> B -> C -> D
f a :: B -> C -> D
f a b :: C -> D
f a b c :: D
This is why Haskell's function call syntax seems a bit funny, and the typing syntax (->) seems funny. Every time you apply an argument you get a new object back which represents the result of applying the function. Once you've applied everything to the left of the rightmost type, you have the result.
It's a statement of implication. If I have an a and an f, the most I can have is a function which takes arguments of type B, C, and D, and so forth.