Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipe symbol in elm action method

Tags:

haskell

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 | do here?

What does flower brackets {} mean? And does the action Delete return any value?

This code is taken from elm's Todo tutorial.


1 Answers

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.

like image 184
max taldykin Avatar answered Sep 12 '25 20:09

max taldykin