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.
 
 
 

18 lines
511 B

  1. But let's not stop here. What does the dot \code{(.)} actually mean?
  2. \vspace{\baselineskip}
  3. \\
  4. \pause
  5. It's just a function (the \emph{prefix} version of \code{.})! Here is the type signature:
  6. \begin{haskellcode}
  7. (.) :: (b -> c) -> (a -> b) -> a -> c
  8. \end{haskellcode}
  9. \pause
  10. \textbf{Exercise:} Implement it! It's really just one line! Remember the mathematical definition.
  11. \vspace{\baselineskip}
  12. \\
  13. \pause
  14. Solution:
  15. \begin{haskellcode}
  16. (.) :: (b -> c) -> (a -> b) -> a -> c
  17. (.) f g x = f (g x)
  18. \end{haskellcode}