16 lines
609 B
TeX
16 lines
609 B
TeX
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)
|
|
\end{haskellcode}
|
|
On the other hand function application is \emph{left}-associative, so \code{f 3 2} is just a shorthand of \code{(f 3) 2}. Makes sense? |