haskell-lectures/VL2/content/VL2_composition2.tex
2015-04-20 00:51:14 +02:00

18 lines
511 B
TeX

But let's not stop here. What does the dot \code{(.)} actually mean?
\vspace{\baselineskip}
\\
\pause
It's just a function (the \emph{prefix} version of \code{.})! Here is the type signature:
\begin{haskellcode}
(.) :: (b -> c) -> (a -> b) -> a -> c
\end{haskellcode}
\pause
\textbf{Exercise:} Implement it! It's really just one line! Remember the mathematical definition.
\vspace{\baselineskip}
\\
\pause
Solution:
\begin{haskellcode}
(.) :: (b -> c) -> (a -> b) -> a -> c
(.) f g x = f (g x)
\end{haskellcode}