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 |
do here?
What does flower brackets {}
mean? And does the action Delete
return any value?
This code is taken from elm's Todo tutorial.
This is record update syntax: http://elm-lang.org/docs/records#updating-records
{ model | tasks <- value }
returns model
record with tasks
field set to a new value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With