Skip to content

Commit

Permalink
Continue corrections in the book (#107)
Browse files Browse the repository at this point in the history
* wip

* wip
  • Loading branch information
winitzki authored Aug 22, 2024
1 parent 5bf853f commit 07efb66
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions sofp-src/lyx/sofp-filterable.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -22252,7 +22252,7 @@ def liftOpt_F[A, B](f: A => Option[B]): F[B] => F[A] = {

\begin_inset Formula
\[
\xymatrix{S^{B,F^{B}}\ar[r]\sp(0.525){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[rd]\sb(0.45){\text{liftOpt}_{F}(f)\triangleq~~~} & S^{A,F^{B}}\ar[d]\sp(0.45){\big(\overline{\text{liftOpt}_{F}}(f)\big)^{\uparrow S^{A,\bullet}}}\\
\xymatrix{S^{B,F^{B}}\ar[r]\sp(0.525){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[rd]\sb(0.45){\text{liftOpt}_{F}(f)\triangleq~~~} & S^{A,F^{B}}\ar[d]\sp(0.4){\big(\overline{\text{liftOpt}_{F}}(f)\big)^{\uparrow S^{A,\bullet}}}\\
\xyScaleY{1.8pc}\xyScaleX{6pc} & S^{A,F^{A}}
}
\]
Expand Down Expand Up @@ -22382,7 +22382,7 @@ In this derivation, we have used the naturality law of
That law is:
\begin_inset Formula
\[
\xymatrix{S^{B,R}\ar[r]\sp(0.5){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[d]\sb(0.55){(h^{:R\rightarrow R^{\prime}})^{\uparrow S^{B,\bullet}}} & S^{A,R}\ar[d]\sp(0.55){h^{\uparrow S^{A,\bullet}}}\\
\xymatrix{S^{B,R}\ar[r]\sp(0.5){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[d]\sb(0.5){(h^{:R\rightarrow R^{\prime}})^{\uparrow S^{B,\bullet}}} & S^{A,R}\ar[d]\sp(0.4){h^{\uparrow S^{A,\bullet}}}\\
\xyScaleY{1.8pc}\xyScaleX{6.0pc}S^{B,R^{\prime}}\ar[r]\sp(0.45){\text{liftOpt}_{S}(f)} & S^{A,R^{\prime}}
}
\]
Expand Down Expand Up @@ -26098,7 +26098,7 @@ headOption
:
\begin_inset Formula
\[
\xymatrix{\text{List}^{A}\ar[r]\sp(0.55){\text{headOpt}^{A}}\ar[d]\sb(0.5){(f^{:A\rightarrow B})^{\uparrow\text{List}}} & \text{Opt}^{A}\ar[d]\sb(0.4){f^{\uparrow\text{Opt}}}\\
\xymatrix{\text{List}^{A}\ar[r]\sp(0.55){\text{headOpt}^{A}}\ar[d]\sb(0.5){(f^{:A\rightarrow B})^{\uparrow\text{List}}} & \text{Opt}^{A}\ar[d]\sp(0.45){f^{\uparrow\text{Opt}}}\\
\xyScaleY{1.6pc}\xyScaleX{4.5pc}\text{List}^{B}\ar[r]\sp(0.55){\text{headOpt}^{B}} & \text{Opt}^{B}
}
\]
Expand Down
4 changes: 2 additions & 2 deletions sofp-src/lyx/sofp-functors.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ A

\end_inset

or a failure.
or information about a failure.
The data structure
\begin_inset listings
inline true
Expand Down Expand Up @@ -1020,7 +1020,7 @@ Option

\end_inset

, which is written in the type notation as:
, which we will write in the type notation as:
\begin_inset Formula
\[
\text{Opt}^{A}\triangleq\bbnum 1+A\quad.
Expand Down
4 changes: 2 additions & 2 deletions sofp-src/lyx/sofp-preface.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ github
\end_layout

\begin_layout Standard
No generative AI was used for creating any material in this book.
No generative AI was used for creating or editing this book.
\end_layout

\begin_layout Addsec
Expand Down Expand Up @@ -952,7 +952,7 @@ noprefix "false"

\end_inset

, which summarizes the code notation more systematically and clarifies it
, which explains the code notation more systematically and clarifies it
with additional examples.
Appendix
\begin_inset space ~
Expand Down
2 changes: 1 addition & 1 deletion sofp-src/lyx/sofp-typeclasses.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -19798,7 +19798,7 @@ In the
and rewrite the law as:
\begin_inset Formula
\begin{equation}
\text{for any }f^{:A\rightarrow B}:\quad\quad\text{pu}_{F}\bef f^{\uparrow F}=f\bef\text{pu}_{F}\quad.\label{eq:naturality-law-of-pure}
\text{for any }f^{:A\rightarrow B}:\quad\text{pu}_{F}\bef f^{\uparrow F}=f\bef\text{pu}_{F}\quad.\label{eq:naturality-law-of-pure}
\end{equation}

\end_inset
Expand Down
Binary file modified sofp-src/tex/chapter3-picture.pdf
Binary file not shown.
11 changes: 6 additions & 5 deletions sofp-src/tex/sofp-functors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ \subsection{Motivation. Type constructors that wrap data}
express quite different kinds of wrapping. The data structure implementing
\lstinline!List[A]! can hold a variable number of values of type
\lstinline!A!. The data structure \lstinline!Try[A]! holds either
a successfully computed value of type \lstinline!A! or a failure.
The data structure \lstinline!Future[A]! implements a computation
that has been scheduled to run but may not have finished yet, and
may compute a value of type \lstinline!A! (or fail) at a later time.
a successfully computed value of type \lstinline!A! or information
about a failure. The data structure \lstinline!Future[A]! implements
a computation that has been scheduled to run but may not have finished
yet, and may compute a value of type \lstinline!A! (or fail) at a
later time.
Since the \textsf{``}wrappers\textsf{''} \lstinline!List!, \lstinline!Try!, and
\lstinline!Future! are so different, the methods for creating and
Expand Down Expand Up @@ -81,7 +82,7 @@ \subsection{Motivation. Type constructors that wrap data}
\subsection{Example: \texttt{Option} and the identity law\label{subsec:f-Example:-Option-and}}
As another example of a \textsf{``}data wrapper\textsf{''}, consider the type constructor
\lstinline!Option!, which is written in the type notation as:
\lstinline!Option!, which we will write in the type notation as:
\[
\text{Opt}^{A}\triangleq\bbnum 1+A\quad.
\]
Expand Down
12 changes: 7 additions & 5 deletions sofp-src/tex/sofp-preface.tex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
to work but are intended only for explanation and illustration. As
a rule, the code is not optimized for performance. Although the code
examples are in Scala, the material in this book also applies to many
other functional programming languages.
other languages.

A software engineer needs to learn only those few fragments of mathematical
theory that answer questions arising in the programming practice.
Expand Down Expand Up @@ -71,11 +71,13 @@
also thanks Bill Venners for many helpful comments on the draft, and
Harald Gliebe, Andreas R\"ohler, and Philip Schwarz for contributing
corrections to the text via \texttt{github}. The author is grateful
to Frederick Pitts and several anonymous \texttt{github} contributors
who reported errors in the draft and made helpful suggestions, and
to Barisere Jonathan for valuable assistance with setting up automatic
to Frederick Pitts, Hew Wolff, and several anonymous \texttt{github}
contributors who reported errors in the draft and made helpful suggestions,
and to Barisere Jonathan for valuable assistance with setting up automatic
builds.
No generative AI was used for creating or editing this book.
\addsec{Formatting conventions used in this book}
\begin{itemize}
\item Text in boldface indicates a new concept or term that is being defined
Expand Down Expand Up @@ -118,7 +120,7 @@
of functions (Scala\textsf{'}s method \lstinline!andThen!). If the notation
still appears hard to follow after going through Chapters~\ref{chap:5-Curry-Howard}\textendash \ref{chap:Functors,-contrafunctors,-and},
readers will benefit from working through Chapter~\ref{chap:Reasoning-about-code},
which summarizes the code notation more systematically and clarifies
which explains the code notation more systematically and clarifies
it with additional examples. Appendix~\ref{chap:Appendix-Notations}
on page~\pageref{chap:Appendix-Notations} summarizes this book\textsf{'}s
notation for types and code.
Expand Down
6 changes: 3 additions & 3 deletions sofp-src/tex/sofp.tex
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@
{\footnotesize{}ISBN (e-book): 978-0-359-76877-6}\\
{\footnotesize{}ISBN: 978-0-359-76877-6}\\
\\
{\scriptsize{}Source hash (sha256): 6d2c32ff2563fe31726d89631c315c93e6767fbcdcf275c18dfd4133aba3970e}\\
{\scriptsize{}Git commit: 6d0c698eea409a8a361e2274db6802396e7fa5fc}\\
{\scriptsize{}PDF file built on Thu, 15 Aug 2024 23:02:20 +0200 by pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) on Darwin}\\
{\scriptsize{}Source hash (sha256): 3c11991097dc72ed4cac251fc86e6ababb7ee20fe75421517a164b6032c7b24a}\\
{\scriptsize{}Git commit: 5bf853f262fadf3c192f9ab6be13ca4deb99b43d}\\
{\scriptsize{}PDF file built on Thu, 22 Aug 2024 21:37:50 +0200 by pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) on Darwin}\\
~\\
{\scriptsize{}Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU Free Documentation License,
Expand Down

0 comments on commit 07efb66

Please sign in to comment.