Functional updates to complex values

How to change the state of a value without needing side-effects, basically how to do what is super easy in imperative programming, but make it hard. 😈

Untitled


Untitled

Well-behaved Lenses

A lens is well-behaved when it satisfy the so called Put-Get and Get-Put laws.


Untitled

Untitled


The VERY well-behaved lens

Put-Put Law

Untitled

If a lens satisfy the three above mentioned laws it is called VERY well-behaved