Update of nested record fields

It would be nice to be able to do updates of nested record fields in a cleaner way. For example:

data A = A with
  b : B

data B = B with
  c : Int
  d : Text

-- What we currently have to do
setZero: A -> A
setZero a = a with
  b = a.b with
    c = 0

-- Nice to have syntax to do the same thing
betterSetZero : A -> A
betterSetZero a = a with b.c = 0
3 Likes

Hi @huw, this feature already exists in SDK 1.13.0 and newer. The syntax looks exactly like your example which compiles without changes on SDK 1.13. You can find more info in the release notes Release of Daml Connect 1.13.0 - Daml

5 Likes

Awesome thanks for this feature. Will upgrade to latest sdk.

1 Like