You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
615 B

  1. So in mathematical terms you can say:\\
  2. $f : A_1 \times ... \times A_n \mapsto B$
  3. \vspace{\baselineskip}
  4. \\
  5. gets modified into:\\
  6. \pause
  7. $f' : A_1 \mapsto (A_2 \mapsto (\ ...\ (A_n \mapsto B)))$
  8. \vspace{\baselineskip}
  9. \\
  10. \pause
  11. 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:
  12. \begin{haskellcode}
  13. f :: Int -> Int -> Int
  14. f :: Int -> (Int -> Int)
  15. \end{haskellcode}
  16. 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?