mirror of
https://github.com/hmemcpy/milewski-ctfp-pdf.git
synced 2024-11-23 12:24:40 +03:00
Lots of tweaks.
This commit is contained in:
parent
45b72af377
commit
3715b32a06
@ -3,7 +3,7 @@ their structure.
|
||||
|
||||
\begin{wrapfigure}[13]{R}{0pt}
|
||||
\raisebox{0pt}[\dimexpr\height-0.75\baselineskip\relax]{
|
||||
\fbox{\includegraphics[width=60mm]{images/1_functors.jpg}}}%
|
||||
\includegraphics[width=60mm]{images/1_functors.jpg}}%
|
||||
\end{wrapfigure}
|
||||
|
||||
\noindent
|
||||
@ -114,7 +114,7 @@ commuting naturality square in $\cat{D}$ for every morphism in $\cat{C}$.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\fbox{\includegraphics[width=60mm]{images/naturality.jpg}}
|
||||
\includegraphics[width=60mm]{images/naturality.jpg}
|
||||
\end{figure}
|
||||
|
||||
\noindent
|
||||
|
@ -501,8 +501,7 @@ bool f() {
|
||||
\end{Verbatim}
|
||||
\item
|
||||
\begin{Verbatim}
|
||||
int f(int x)
|
||||
{
|
||||
int f(int x) {
|
||||
static int y = 0;
|
||||
y += x;
|
||||
return y;
|
||||
|
@ -257,8 +257,8 @@ adders follows from the second interpretation of the type signature of
|
||||
tells us that \code{mappend} maps an element of a monoid set to a
|
||||
function acting on that set.
|
||||
|
||||
\begin{wrapfigure}[11]{R}{0pt}
|
||||
\raisebox{0pt}[\dimexpr\height-0.75\baselineskip\relax]{
|
||||
\begin{wrapfigure}[12]{R}{0pt}
|
||||
\raisebox{0pt}[\dimexpr\height-0.85\baselineskip\relax]{
|
||||
\includegraphics[width=40mm]{images/monoid.jpg}}
|
||||
\end{wrapfigure}
|
||||
|
||||
|
@ -21,7 +21,7 @@ Library.
|
||||
|
||||
\begin{figure}
|
||||
\centering
|
||||
\fbox{\includegraphics[width=1.56250in]{images/pair.jpg}}
|
||||
\includegraphics[width=1.56250in]{images/pair.jpg}
|
||||
\end{figure}
|
||||
|
||||
\noindent
|
||||
|
@ -71,7 +71,7 @@ each argument separately to be able to define a bifunctor.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\fbox{\includegraphics[width=40mm]{images/bimap.jpg}}
|
||||
\includegraphics[width=40mm]{images/bimap.jpg}
|
||||
\caption{bimap}
|
||||
\end{figure}
|
||||
|
||||
|
@ -237,7 +237,7 @@ characteristic of a \emph{contravariant} functor.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\fbox{\includegraphics[width=2.59375in]{images/homsetmapping.jpg}}
|
||||
\includegraphics[width=2.59375in]{images/homsetmapping.jpg}
|
||||
\end{figure}
|
||||
|
||||
\noindent
|
||||
|
@ -32,7 +32,7 @@ various other (co-)limits, exponential objects, free monoids, etc.
|
||||
|
||||
\begin{wrapfigure}[9]{R}{0pt}
|
||||
\raisebox{0pt}[\dimexpr\height-0.75\baselineskip\relax]{
|
||||
\fbox{\includegraphics[width=1.78125in]{images/productranking.jpg}}}%
|
||||
\includegraphics[width=1.78125in]{images/productranking.jpg}}%
|
||||
\end{wrapfigure}
|
||||
|
||||
The product is a simple example of a universal construction. We pick two
|
||||
@ -73,7 +73,7 @@ you up and down or back and forth --- so to speak. You can visualize the
|
||||
transformation maps one such sheet corresponding to F, to another,
|
||||
corresponding to G.
|
||||
|
||||
\begin{wrapfigure}[10]{R}{0pt}
|
||||
\begin{wrapfigure}[13]{R}{0pt}
|
||||
\raisebox{0pt}[\dimexpr\height-0.75\baselineskip\relax]{
|
||||
\includegraphics[width=60mm]{images/sheets.png}}%
|
||||
\end{wrapfigure}
|
||||
|
@ -264,8 +264,7 @@ join :: Monoid w => Writer w (Writer w a) -> Writer w a
|
||||
join (Writer ((Writer (a, w')), w)) = Writer (a, w `mappend` w')
|
||||
\end{Verbatim}
|
||||
|
||||
\section{\texorpdfstring{The \code{do}
|
||||
Notation}{The do Notation}}
|
||||
\section{The \texttt{do} Notation}
|
||||
|
||||
One way of writing code using monads is to work with Kleisli arrows ---
|
||||
composing them using the fish operator. This mode of programming is the
|
||||
|
@ -454,11 +454,11 @@ As you can see, continuations are composed inside out. The final handler
|
||||
\code{hb} is called from the innermost layer of the computation.
|
||||
Here's the full instance:
|
||||
|
||||
\begin{Verbatim}
|
||||
\begin{minted}[breaklines,fontsize=\small]{text}
|
||||
instance Monad (Cont r) where
|
||||
ka >>= kab = Cont (\hb -> runCont ka (\a -> runCont (kab a) hb))
|
||||
return a = Cont (\ha -> ha a)
|
||||
\end{Verbatim}
|
||||
\end{minted}
|
||||
|
||||
\subsection{Interactive Input}
|
||||
|
||||
|
@ -4,7 +4,7 @@ combining algebras with monads we not only gain a lot of functionality
|
||||
but we can also answer a few interesting questions.
|
||||
\begin{wrapfigure}[8]{R}{0pt}
|
||||
\raisebox{0pt}[\dimexpr\height-0.75\baselineskip\relax]{
|
||||
\fbox{\includegraphics[width=1.27083in]{images/pigalg.png}}}%
|
||||
\includegraphics[width=1.27083in]{images/pigalg.png}}%
|
||||
\end{wrapfigure}
|
||||
|
||||
One such question
|
||||
|
@ -13,7 +13,7 @@ Bartosz Milewski\\
|
||||
|
||||
\vspace{1.26em}
|
||||
\noindent
|
||||
Version 0.2, October 2017\\
|
||||
Version 0.3, October 2017\\
|
||||
|
||||
\vspace{1.6em}
|
||||
\noindent
|
||||
|
@ -10,6 +10,8 @@
|
||||
% ********************************************************** %
|
||||
|
||||
% HISTORY:
|
||||
% * Version 0.3 (October, 2017) - Made code font smaller. Various fixes.
|
||||
%
|
||||
% * Version 0.2 (October, 2017) - Math typesetting and lots of tweaks!
|
||||
%
|
||||
% * Version 0.1 (September, 2017) by Igal Tabachnik.
|
||||
|
Loading…
Reference in New Issue
Block a user