Document lifted selectors.

Fixes #303
This commit is contained in:
Iavor Diatchki 2020-05-05 14:59:45 -07:00
parent c3eca4f22a
commit 2219aca55c
4 changed files with 35 additions and 0 deletions

Binary file not shown.

View File

@ -385,6 +385,24 @@ f p = x + y where
(x, y) = p
\end{verbatim}
Selectors are also lifted through sequence and function types,
point-wise, so that the following equations should hold:
\begin{verbatim}
xs.l == [ x.l | x <- xs ] // sequences
f.l == \x -> (f x).l // functions
\end{verbatim}
Thus, if we have a sequence of tuples, \texttt{xs}, then we can quickly
obtain a sequence with only the tuples' first components by writing
\texttt{xs.0}.
Similarly, if we have a function, \texttt{f}, that computes a tuple of
results, then we can write \texttt{f.0} to get a function that computes
only the first entry in the tuple.
This behavior is quite handy when examining complex data at the REPL.
\hypertarget{updating-fields}{%
\subsection{Updating Fields}\label{updating-fields}}

View File

@ -344,6 +344,23 @@ patterns use braces. Examples:
f p = x + y where
(x, y) = p
Selectors are also lifted through sequence and function types, point-wise,
so that the following equations should hold:
xs.l == [ x.l | x <- xs ] // sequences
f.l == \x -> (f x).l // functions
Thus, if we have a sequence of tuples, `xs`, then we can quickly obtain a
sequence with only the tuples' first components by writing `xs.0`.
Similarly, if we have a function, `f`, that computes a tuple of results,
then we can write `f.0` to get a function that computes only the first
entry in the tuple.
This behavior is quite handy when examining complex data at the REPL.
Updating Fields
---------------

Binary file not shown.