3 ms·
Lenses aren't really designed for providing OOP, they just happen to be able to do that too. Have you ever wanted to return a copy of an array with an element
by PeCaN 11y ago
Lenses aren't really designed for providing OOP, they just happen to be able to do that too.
Have you ever wanted to return a copy of an array with an element changed? Like (JS) var new_a = a.concat(b) gives you a new array, don't you sometimes wish there was e.g. new_a = a.update(3, x)? I sure have. That's what lenses do, and they do that more efficiently and for way more than just arrays.