Imagine the type a = {name: String, age : Int}.
If you want to access the age part of this type
or modify only the age this is simple you would use
Elm syntax like x.age or {x | age = 7 } to ease
the process.
Now imagine that the a is much much more complex, like
a record whose fields are also records and so on for 10 levels.
Elm does not have buitin syntax to ease this case. That's
where lenses comes in.
A lens is like zooming on a part of a type, enabling to access or modify this part with ease. It is strongly related to Huet's zipper.
Take the a lens of type Lens a b. It enable to access the a
part of b and modify it simply. The benefits of lenses is they
compose naturally.
Build a lens from an equivalence between types a and b
Compose two lenses
If you have a lens from a to b and a function on a
then you get a function on b.
The type of a lens