A syntax that would make sense with current trends in elm is something to
the effect of:
model
|> Record.map .val1 increase
|> Record.update .val2 42
This of course relies on `Record.map` and `Record.set` which do not exist
and (ab)uses .field syntax in ways which don't actually work.
On Monday, December 5, 2016 at 4:02:49 PM UTC-5, Wouter In t Velt wrote:
>
> 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.