v1.10.0
Improvements
Two new standard-library pipe optimizations
enum |> Enum.map(fun) |> Enum.intersperse(separator)=>Enum.map_intersperse(enum, separator, fun)enum |> Enum.sort() |> Enum.reverse()=>Enum.sort(enum, :desc)
And Req (the http client library) pipe optimizations, as detailed below
Req pipe optimizations
Req is a popular HTTP Client. If you aren't using it, you can just ignore this whole section!
Reqs 1-arity "execute the request" functions (delete get head patch post put request run) have a 2-arity version that takes a superset of the arguments Req.new/1 does as its first argument, and the typical options keyword list as its second argument. And so, many places developers are calling a 1-arity function can be replaced with a 2-arity function.
More succinctly, these two statements are equivalent:
foo |> Req.new() |> Req.merge(bar) |> Req.post!()Req.post!(foo, bar)
Styler now rewrites the former to the latter, since "less is more" or "code is a liability".
It also rewrites |> Keyword.merge(bar) |> Req.foo() to |> Req.foo(bar). This changes the program's behaviour, since Keyword.merge would overwrite existing values in all cases, whereas Req 2-arity functions intelligently deep-merge values for some keys, like :headers.