News for hackers. Stuff that matters.
Re:Getters and Setters in Kind by moomin on Sunday October 17, 2021 @06:54PM (#28900501)
I think I disagree with the author about what the problems with lens are in Haskell. In particular, I think the performance is much better than represented. (Assuming you do everything right… but that’s a whole different problem.) Its also powerful in a way a getter or setter syntax will never be.

I think the real problem with lens is: the type errors you get are completely unworkable. You could address this with newtypes but you’d lose expressivity and performance. Basically lens is at the bleeding edge of what a functional compiler can cope with.

It’d be an interesting research problem to see if this can be fixed.

Re:Getters and Setters in Kind by tome on Monday October 18, 2021 @03:26PM (#28910339)
> You could address this with newtypes but you’d lose expressivity and performance.

optics uses newtypes. It loses infinitesimally in expressivity and not at all in performance, as far as I am aware. What were you thinking of?

https://hackage.haskell.org/package/optics

Re:Getters and Setters in Kind by moomin on Tuesday October 19, 2021 @04:57AM (#28916151)
I could be wrong (It's a common occurrence!), but I thought a lot of the lens perf relied on inlining that isn't as easy to pull off with a newtype/profunctor design. Can't find any references for performance comparisons.
Re:Getters and Setters in Kind by tome on Tuesday October 19, 2021 @12:32PM (#28920075)
Interesting. I don't have any evidence either way!