3 ms·
Though these operators can be used in modifiable lvalue expressions, while lenses are (according to this article) pure functions.
by mannykannot 8y ago
Though these operators can be used in modifiable lvalue expressions, while lenses are (according to this article) pure functions.
- lindig 8y agoAs pointed out in this thread, a lens has to return the modified object as it can't update it as a side effect. That is the reason no universal dot-like lens operator exists in Haskell but it needs to be composed based on the data structures that it targets.
- mannykannot 8y agoWell, yes, but bear in mind that the absence of side effects is seen as a virtue in functional programming, and it is a point of view that I have considerable agreement with.