News for hackers. Stuff that matters.
Re:Haskell RecordDotSyntax language extension proposal (Acce... by garethrowlands on Monday September 21, 2020 @07:37AM (#24542132)
Lens has this:

    e & lbl .~ value

It's not an in-place update like `e.lbl = value`.
Re:Haskell RecordDotSyntax language extension proposal (Acce... by srtjstjsj on Monday September 21, 2020 @09:45AM (#24543320)
That doesn't solve GP's problem of "not looking exactly like C++/Java/Python"
Re:Haskell RecordDotSyntax language extension proposal (Acce... by pbiggar on Monday September 21, 2020 @10:34AM (#24543944)
My goal isn't to look _exactly_ like C++/etc, but rather to have a fairly natural duality between read and write. You can read with:

    a.b.c.d
but a write is:

    let a = {a with b = { a.b with c = { a.b.c with d = 5 } } } }
which is much much more verbose than the OO/imperative:

    a.b.c.d = 5
Re:Haskell RecordDotSyntax language extension proposal (Acce... by kqr on Tuesday September 22, 2020 @01:13AM (#24551082)
Yeah, lenses let you do

    a & b.c.d .~ 5
To construct a new version of `a` where those nested fields have the new value 5.

Or for an in-place update in a context where that is allowed,

    a.b.c.d .= 5
The lens concept is incredibly nice.