2015-04-19 22:32:50 +00:00
So in mathematical terms you can say:\\
$ f : A _ 1 \times ... \times A _ n \mapsto B $
\vspace { \baselineskip }
\\
gets modified into:\\
\pause
$ f' : A _ 1 \mapsto ( A _ 2 \mapsto ( \ ... \ ( A _ n \mapsto B ) ) ) $
\vspace { \baselineskip }
\\
\pause
Did you just notice the braces? They are \textbf { very} important! So, currying is \emph { right} -associative which means that these two signatures are equivalent:
\begin { haskellcode}
f :: Int -> Int -> Int
f :: Int -> (Int -> Int)
2015-04-20 22:24:24 +00:00
-- but this is NOT the same
f :: (Int -> Int) -> Int
2015-04-19 22:32:50 +00:00
\end { haskellcode}
2015-04-20 18:55:41 +00:00
On the other hand function application is \emph { left} -associative, so \hinline { f 3 2} is just a shorthand of \hinline { (f 3) 2} . Makes sense?