elm-lang.org
elm-lang.org copied to clipboard
Add pattern aliasing to syntax reference
The ability of using pattern aliasing, ie:
update ({ a } as model) action
-- rest of function body
is missing from the syntax docs.
+1
This seems cool. What are its uses exactly? I've seen it used to update a nested record. I've used let expressions or helper functions to do that.
You can destruct records/nested DS within the function definition itself
It is also used for aliasing modules as in
import Html.Attributes as Attr
I see. The example here is illustrative. So it saves you writing object.x everywhere, you just write x.