haskell-lectures/VL2/content/VL2_composition2.tex

18 lines
517 B
TeX

But let's not stop here. What does the dot \hinline{(.)} actually mean?
\vspace{\baselineskip}
\\
\pause
It's just a function (the \emph{prefix} version of \hinline{.})! 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}