News for hackers. Stuff that matters.
Re:Why Concurrency Is Hard by nyanpasu64 on Wednesday November 11, 2020 @01:10AM (#25055955)
I've heard about lenses, but never actually worked with them. This syntax seems to construct a "path" of sorts from the root to a field. What language is this? What type does the `set` operator/keyword return?
Re:Why Concurrency Is Hard by lmm on Wednesday November 11, 2020 @02:13AM (#25056183)
It's Scala with Monocle (and it's off the top of my head, so apologies for any mistake). `set` usually returns a function for transforming values of the root type, but this simplified syntax will apply it immediately to `config`, so it'll return a copy of config with the modification applied to it.