Skip to content

Commit

Permalink
minor correction
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei.winitzki committed Mar 21, 2021
1 parent b421f6e commit 6efa5c4
Showing 1 changed file with 21 additions and 31 deletions.
52 changes: 21 additions & 31 deletions sofp-src/sofp-applicative.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,10 @@ Motivation for applicative functors
\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
vspace{-0.25cm}
We would like to parallelize independent computations
\end_layout

\end_inset

\begin_layout Standard
Monads are inconvenient for expressing
\emph on
independent
Expand Down Expand Up @@ -452,10 +444,6 @@ Future { c1 }.flatMap { x

\end_layout

\begin_layout Standard
We would like to parallelize independent computations
\end_layout

\begin_layout Standard
We would like to accumulate
\emph on
Expand Down Expand Up @@ -634,7 +622,10 @@ for {
\end_layout

\begin_layout Standard
We would like to express a computation where effects are unordered
We would like to express a computation where effects are unordered and /
or do not depend on previous results.
flatMap cannot express independent effects even if we use flatMap(_ =>
...)
\end_layout

\begin_layout Standard
Expand Down Expand Up @@ -721,18 +712,6 @@ map3
\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
vspace{-0.15cm}
\end_layout

\end_inset

Consider 1, 2, 3, ...
commutative and independent
\begin_inset Quotes eld
Expand Down Expand Up @@ -1104,6 +1083,10 @@ status open
\end_inset


\family default
\size default
\color inherit

\begin_inset ERT
status open

Expand All @@ -1116,6 +1099,13 @@ hrule

\end_inset

Note that the map2 function defined via flatMap will have the right type
signature and will work.
But sometimes we need a different implementation, not equivalent to an
implementation via flatMap.
\family typewriter
\size footnotesize
\color blue

\begin_inset VSpace defskip
\end_inset
Expand Down Expand Up @@ -5332,7 +5322,7 @@ contramap
Examples of profunctors:
\size footnotesize

\begin_inset Formula $P^{A}\triangleq\bbnum1+\text{Int}\times A\rightarrow A$
\begin_inset Formula $P^{A}\triangleq\bbnum 1+\text{Int}\times A\rightarrow A$
\end_inset

;
Expand Down Expand Up @@ -6231,7 +6221,7 @@ pure

\begin_layout Enumerate
Show that
\begin_inset Formula $F^{A}\triangleq\left(A\rightarrow Z\right)\rightarrow\bbnum 1+A$
\begin_inset Formula $F^{A}\triangleq\left(A\rightarrow Z\right)\rightarrow\bbnum1+A$
\end_inset

is a functor but not applicative.
Expand All @@ -6255,7 +6245,7 @@ Show that

\begin_layout Enumerate
Implement an applicative instance for
\begin_inset Formula $F^{A}=\bbnum 1+\text{Int}\times A+A\times A\times A$
\begin_inset Formula $F^{A}=\bbnum1+\text{Int}\times A+A\times A\times A$
\end_inset

.
Expand Down Expand Up @@ -6297,7 +6287,7 @@ For any contrafunctor

\begin_layout Enumerate
Show that the recursive functor
\begin_inset Formula $F^{A}\triangleq\bbnum 1+G^{A\times F^{A}}$
\begin_inset Formula $F^{A}\triangleq\bbnum1+G^{A\times F^{A}}$
\end_inset

is applicative if
Expand Down

0 comments on commit 6efa5c4

Please sign in to comment.