pasteldream
Joined 1 year ago
Joined 1 year ago
Edit: It’s not deepcopying the whole struct, just the parts that need to point to something new. So if you update a.b.c, it will shallow-copy a and a.b, but nothing else.
Lenses serve many purposes. All I’m saying is that in practice, the most common role they fulfil is to act as a counterpart for mutable references in contexts where you want or need immutability.
Can the use of lenses make a program more “composable”? Maybe, but if you have an example of a program taking advantage of that flexibility I’d like to see it.
Your natural alternative to lenses in imperative languages is usually to just store a reference or pointer to the part you want to modify. Like a lens, but in-place.
I guess you gain persistence of your entire app’s state (which makes time travel debugging easier) but that’s all I can think of.
It’s scummy to shove ads in my face without at least warning me and giving me a chance to leave, I think.