Relevant issue on the compiler repo: https://github.com/elm/compiler/issues/984
I usually create helper funtions:
asBarIn : Foo -> Bar -> Foo
asBarIn foo bar =
{ foo | bar = bar }
Which can then be chained like this:
createBar 123
|> asBarIn model.foo
|> asFooIn model
In my experience this has been a nicer pattern than the flipped variant:
setBar : Bar -> Foo -> Foo
setBar bar foo =
-- or `withBar`
{ foo | bar = bar }