18 lines
511 B
TeX
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} |