From 07efb660d315750d71d6b87190f76154b83d5915 Mon Sep 17 00:00:00 2001 From: Sergei Winitzki Date: Thu, 22 Aug 2024 23:37:40 +0200 Subject: [PATCH] Continue corrections in the book (#107) * wip * wip --- sofp-src/lyx/sofp-filterable.lyx | 6 +++--- sofp-src/lyx/sofp-functors.lyx | 4 ++-- sofp-src/lyx/sofp-preface.lyx | 4 ++-- sofp-src/lyx/sofp-typeclasses.lyx | 2 +- sofp-src/tex/chapter3-picture.pdf | Bin 3740 -> 3740 bytes sofp-src/tex/sofp-functors.tex | 11 ++++++----- sofp-src/tex/sofp-preface.tex | 12 +++++++----- sofp-src/tex/sofp.tex | 6 +++--- 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/sofp-src/lyx/sofp-filterable.lyx b/sofp-src/lyx/sofp-filterable.lyx index 2bc687916..e97216c95 100644 --- a/sofp-src/lyx/sofp-filterable.lyx +++ b/sofp-src/lyx/sofp-filterable.lyx @@ -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}} } \] @@ -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}} } \] @@ -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} } \] diff --git a/sofp-src/lyx/sofp-functors.lyx b/sofp-src/lyx/sofp-functors.lyx index 8ef2b13c0..cc279d2f9 100644 --- a/sofp-src/lyx/sofp-functors.lyx +++ b/sofp-src/lyx/sofp-functors.lyx @@ -685,7 +685,7 @@ A \end_inset - or a failure. + or information about a failure. The data structure \begin_inset listings inline true @@ -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. diff --git a/sofp-src/lyx/sofp-preface.lyx b/sofp-src/lyx/sofp-preface.lyx index 1e19215e1..5002cea5e 100644 --- a/sofp-src/lyx/sofp-preface.lyx +++ b/sofp-src/lyx/sofp-preface.lyx @@ -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 @@ -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 ~ diff --git a/sofp-src/lyx/sofp-typeclasses.lyx b/sofp-src/lyx/sofp-typeclasses.lyx index f3fa9a5f1..43d515608 100644 --- a/sofp-src/lyx/sofp-typeclasses.lyx +++ b/sofp-src/lyx/sofp-typeclasses.lyx @@ -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 diff --git a/sofp-src/tex/chapter3-picture.pdf b/sofp-src/tex/chapter3-picture.pdf index 648b1e8509dc93448c1e3ba7c5657b60e96ddabe..db01aecb8851feb9e28f4627c88a8a2299d1eb25 100644 GIT binary patch delta 174 zcmbOuJ4bedEhm?eQHYVDm9e>%@nm;SLu76f=Tlw_^R&cdb0Z^NON*4m%_UsyOqxbU zMux`b#-`c^M(PFz>Y7~ozWFIGi6yBTE>=bcMkWRpP!*e(@XTg(GIcXCGca{AH!^gw hG<7wwFg7rEHghy`F)=kVv~+W}w6h_kVsay&GyuclDk%T} delta 174 zcmbOuJ4bedEhm?uX^4@rm4T6!!DM$%Lu76f=Tlyz6oVv##3WN)OJg&$%_UsyOqzzK zM#ct42Bz8uM(PFz>Y7~ozWFIGi6yBTE>=bcMkWRpP!*e(@XTg(a<*_Wb}=+JHZgKE gb}=z@G_e3;OA8BU3rkl+V@pFj8$v23H}XjX0GeAV$p8QV diff --git a/sofp-src/tex/sofp-functors.tex b/sofp-src/tex/sofp-functors.tex index 4c686d315..c1de21e3f 100644 --- a/sofp-src/tex/sofp-functors.tex +++ b/sofp-src/tex/sofp-functors.tex @@ -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 @@ -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. \] diff --git a/sofp-src/tex/sofp-preface.tex b/sofp-src/tex/sofp-preface.tex index 6b9e5ee06..472f96a82 100644 --- a/sofp-src/tex/sofp-preface.tex +++ b/sofp-src/tex/sofp-preface.tex @@ -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. @@ -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 @@ -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. diff --git a/sofp-src/tex/sofp.tex b/sofp-src/tex/sofp.tex index 851b37cb8..031daa1d3 100644 --- a/sofp-src/tex/sofp.tex +++ b/sofp-src/tex/sofp.tex @@ -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,