Re:Lenses: Composable Getters and Setters for Functional Pro...
by mannykannot on Monday December 24, 2018 @08:59AM
(#18752156)
Though these operators can be used in modifiable lvalue expressions, while lenses are (according to this article) pure functions.
[ Parent
| on HN ]
Re:Lenses: Composable Getters and Setters for Functional Pro...
by lindig on Monday December 24, 2018 @11:18AM
(#18752772)
As 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.
Re:Lenses: Composable Getters and Setters for Functional Pro...
by mannykannot on Monday December 24, 2018 @11:28AM
(#18752816)
Well, 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.