Another Look Through Optics

Another Look Through Optics

5 years ago
Anonymous $ZPWJA6-QD2

https://medium.com/@wigahluk/another-look-through-optics-ffd253336e9c

Optics are usually presented as data accessors for immutable data structures, and although this is very useful in functional programming it’s hardly a compelling story if you can opt for mutable structures. I present a different approach to optics as proxies for external APIs, which may help with the understanding of optics and their bigger menu of use-cases.

Lenses and other optics have been championed by functional programmers as one of the golden assets in our toolbox, but almost every time we try to convince others about the virtues of optics we face this look in their eyes like saying: “Are you serious? Are you telling me that it’s easier and better to write getters and setters instead of simply using my dot-syntax?”