Trumpet symbol in the way of action elm
update action model =
case action of
Delete id ->
{ model | tasks <- List.filter (\t -> t.id /= id) model.tasks }
I don't understand this syntax,
{ model | .......... }
What does the pipe symbol mean here |
?
What do flower brackets mean {}
? And does the action return Delete
any value?
This code is taken from the elm Todo tutorial .
+3
source to share
1 answer
This is the syntax for updating a record: http://elm-lang.org/docs/records#updating-records
{ model | tasks <- value }
returns a model
record with the field tasks
set to the new value.
+6
source to share