Update of nested record fields
App Development3 posts331 views9 likesLast activity Jun 2021
HU
huwOP
Jun 2021It 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
CO
cocreature
Jun 2021Hi @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
HU
huw
Jun 2021Awesome thanks for this feature. Will upgrade to latest sdk.