Re:Reflecting on Haskell in 2016
by wyager on Monday December 26, 2016 @12:23AM
(#13257081)
Most people use Lenses for heavily record-oriented programming. They work quite well. They are less convenient than built-in structural syntax like in Javascript, but once you get past the initial inconvenience they are vastly more powerful.
[ Parent
| on HN ]
On the contrary, lenses are far more powerful than what's available in JavaScript and all other OO languages. Traversals and Prisms give so much power that's lacking in OO
I don't see how that's contrary to what the parent said.
I guess that my point was that for the situations where the built in syntax in OO languages is used, the lens alternative is usually at most about 2 characters longer, which is hardly more inconvenient.
That's a point, just one that was entirely missing from your previous comment.
That said, it's not just use. You've also gotta deal with some additional imports, and with defining your lenses. For the simplest case, that's a bit of overhead compared to having it all baked in.
Re:Reflecting on Haskell in 2016
by bipvanwinkle on Monday December 26, 2016 @12:46AM
(#13257144)
I'll need to check out lenses. I've run in to a few annoying this working with records so far so I was hoping some progress was in the works.
I'm not sure how useful an introduction it is, but I really enjoyed this talk:
https://skillsmatter.com/skillscasts/4251-lenses-composition...
The main lens library in Haskell doesn't exactly have no documentation, but it is pretty much impenetrable without a third-party tutorial or blog post. But persevere - it's really powerful!