Updating nested records in Elm
Wouter In t Velt

Good post Wouter. A message to readers..

Those who have heavy influence in the future direction of Elm are frequently asking for empirical use cases. Rather than trying to sift through hundreds of opinions, let’s sift through dozens of actual use cases and ascertain if there is something fundamental about Elm worth changing or is missing. That is a perfectly reasonable approach.

Nested model updates is in my opinion one of those areas. Today, doing something as common and trivial as updating a nested record requires a lot of boilerplate. Boilerplate in the form of let..in blocks or helper functions.

I encourage readers who experience this issue to vocalize their use case so that Elm language and package maintainers have empirical data points to base decisions off of.

Respond to this comment, or post to elm-discuss, or post to /r/elm.

My use case is my data is modeled in a “has a” kind of way. I have rounds and I have lightning talks. A round has a date, it has a theme, and a round also has a collection of lightning talks. I am very often writing boilerplate for updating the nested lightning talk models because the primary domain object I’m usually dealing with is a round.

Are there other ways to cleverly accomplish the same thing? Sure. Are those other ways worth the trade-offs of not allowing nested update syntax? That’s the discussion I think is worth having.