No, the entire point of the operator is to be left associative. If you really need complex expressions, just use parentheses. Elm format will take care of the rest for you.
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/-PLj_eamKVQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
Whoops, I mixed up left and right! The whole point of the operator is that (f <| x <| y ) == (f (x y) ).
The goal is to avoid complex nested expressions, so that Elm doesn't end up looking like Lisp.
Consider where you are adding 4 elements to a dict:
insert wk w <| insert xk x <| insert yk y <| insert zk z myDict.
Without a right-associative operator, this becomes:
insert wk w (insert xk x (insert yk y (insert zk z myDict)))
In my mind, this is harder to read, and you get a huge collection of parentheses at the end.
In your case, you can always take this:
and write it as this:function
There are brackets, but they're not nested, so there isn't a readability issue.
The idea is that function application is left-associative by default, just by placing two things next to each other. We define <| to be right-associative for the cases when the default isn't what you need.
In F#, <| is left-associative; you use it to avoid brackets or naming things with let-bindings when you have to do multi-line computation to arrive at function arguments. I find this very compelling.
The "myDict" example in Joey's post does not adequately explain why <| is right-associative in Elm since, as the post says, that is example is more naturally written with |>.
So what is a good example?
clutter is clutter
However, I'm still hoping to see an example of how to properly use the right-associative pipe-operator <| in Elm, since I apparently want to use it non-idomatically. What is that example?