Skip to content

Commit 78adf50

Browse files
committed
feat: Elaborate definition of very well behaved lens
1 parent 5c28f60 commit 78adf50

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/content/3.9/algebras-for-monads.tex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ \section{Lenses}
396396
\[\mathit{set}\ a\ (\mathit{get}\ a) = a\]
397397
This is the lens law that expresses the fact that if you set a field of
398398
the structure $a$ to its previous value, nothing changes.
399+
This law is also known as GETPUT.
399400

400401
The second condition:
401402
\[\mathit{fmap}\ \mathit{coalg} \circ \mathit{coalg} = \delta_a \circ \mathit{coalg}\]
@@ -421,13 +422,15 @@ \section{Lenses}
421422

422423
\src{snippet14}
423424
tells us that setting the value of a field twice is the same as setting
424-
it once. The second law:
425+
it once. This law is also known as PUTPUT. The second law:
425426

426427
\src{snippet15}
427428
tells us that getting a value of a field that was set to $s$
428-
gives $s$ back.
429+
gives $s$ back. This law is also known as PUTGET.
429430

430-
In other words, a very well behaved lens is indeed a comonad coalgebra for
431+
A lens that satisfies GETPUT and PUTGET is called a well-behaved lens.
432+
If the lens also satisfies PUTPUT, it is called a very well behaved lens.
433+
So, in other words, a very well behaved lens is indeed a comonad coalgebra for
431434
the \code{Store} functor.
432435

433436
\section{Challenges}

0 commit comments

Comments
 (0)