I just gave this a spin in elm repl and it worked out alright.
type alias MySubmodel =
{ x: Int
, y: Int
}
type alias MyModel =
{ a: String
, b: MySubmodel
}
model = { a= "hello", b = {x=1, y=2}}
let
b = model.b
in
{ model | b = { b | x = 7 } }
{ a = "hello", b = { x = 7, y = 2 } }
: { a : String, b : { x : number, y : number1 } }
I would have used “model.b” on the interior curly brace except that appeared to confuse the parser, so I just used a let statement to give it a simpler name first instead.