I don’t know. AFAIK, Immer was born out of Michel Westrate’s frustration with verbosity of immutable assignment in JS, so he wanted to turn { ...obj, sub: { ...obj.sub, prop2: obj.sub.prop2 + 1} } into obj.sub.prop2++.
So far, I’m not sure that your example achieves the terseness of JS.
P.S., also, updating seriously nested structures could be a sign of bad decomposition, so something Immer-like could potentially lead to a worse architecture
Yes…dealing with deeply nested records is very annoying (and in OCaml too).
In OCaml at least you can use a lens library (eg this or this), but with ReScript not having the custom infix operators, something like that would also be sort or tedious to use (imo).
^ That’s a fair point. Though, even if you hide the deeply nested record behind an abstract type, so that consumers don’t have to worry about it, some lens-like library, or immer-like library could still be cool for dealing with that nested-messiness internally.