Here's my example from an attempt to approach this topic in a similar way
<https://medium.com/@ckoster22/good-post-wouter-a-message-to-readers-e783c7fb7a32#.q64m5yin0>
.
*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.*
Here's a simplified snippet of code.
type alias LightningTalk =
{ title : String
, description : String }
type alias Round =
{ talk1 : LightningTalk
, theme : String
, date : Float }
update msg model =
case msg of
UpdateTalkTitle newTitle ->
*let*
* talk1 =*
* model.talk1*
* nextTalk =*
* { talk1 | title = newTitle }*
* in*
* { model | talk1 = nextTalk }*
I think there's room to reduce boilerplate in the highlighted code as well
as make it more beginner friendly, since it's not obvious to store
temporary results in temporary variables like *talk1 *or *nextTalk*.
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.