roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.46k stars 313 forks source link

Implement `&foo` record updater syntax sugar #7002

Closed smores56 closed 3 months ago

smores56 commented 3 months ago

Implements the desugaring of &foo to \record, field -> { record & foo: field }, a.k.a record updates for a single field. This unblocks some of the code in the Action-State proposal, among other things.

This was initially attempted a year ago in https://github.com/roc-lang/roc/pull/5367, which was abandoned the day after publishing. The implementations differ somewhat, as that version was "proper syntax" whereas this is just sugar, but the comments there may be useful to look at.