Op maandag 5 december 2016 21:00:35 UTC+1 schreef Frankie Sardo:
>
> Why does the update syntax accept just a new value instead of accepting a 
> function that updates (or creates) the new value?
>

Don't know about Clojure, but Elm likes you to be explicit and consistent 
about functions, meaning: if the function requires an argument, then you 
should provide an argument if you want to use the output of the function 
instead of the function itself.

So, you could use the functions you describe, as long as you also pass the 
argument:

  { model 
  | val1 = increase model.val1
  , val2 = always42 model.val2
  }

You can find a working example here <https://runelm.io/c/jzw>
Hope this helps



-- 
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.

Reply via email to