Hi guys,
I see a lot of libraries try to allow piping to the first parameter by default, but some don't support this easily.
I propose the following syntax to remedy this where it's needed to pipe to a specific parameter:
1) Normal pipe clearly works the same:
%{} |> SomeCode.function(other_params) === SomeCode.function(%{}, other_params)
2) The number of > dictates the position of the function we want to pipe into:
%{} |>> SomeCode.function("param1") === SomeCode.function("param1", %{})
3) We could also supply opts and other params:
%{} |>> SomeCode.function("param1", %{opts_are_param_3: true}) === SomeCode.function("param1", %{}, %{opts_are_param_3: true})
4) We can move to any specific param we want with more arrows, maybe limit it to 4, say to avoid it becoming ridiculous.
%{} |>>> SomeCode.function("param1", %{this_is_param_2: true}) === SomeCode.function("param1", %{this_is_param_2: true}, %{})
Thoughts? Would other people find this useful in some situations?