Oh hey, `Pipe.to` is the first name I've seen that I like, and putting such things in a `Pipe` module does make argument ordering explicit, and it provides a module to put later pipe related things in too (such as perhaps something to do something when an ok tuple or a raw value but pass an error tuple or error atom or exception or so on past?)
On Wednesday, August 21, 2019 at 5:56:05 AM UTC-6, Ivan Ivanov wrote: > > The `Function` module was introduced not long ago as there was no good >> place to host the functions that are currently in there. Having a function >> with this particular behavior into the `Function` module seems weird to me. >> Was having `Pipe` module considered at any point? Examples: `Pipe.to` or >> `Pipe.into`: > > > "foo" > |> String.upcase() > |> Pipe.to(&Regex.scan(~r/foo/, &1) > > One issue I have with having such function in the `Function` module is > that it will be inconsistent with most of the code - the functions in > `Enum` take the enumerable as the first argument, same goes for `Map`, > `List`, `String`, `Tuple` and so on. > > There is no `Pipe` struct or type and when working with pipes you already > know that a value (first argument) is piped into a function (second > argument), so having such parameters ordering in the `Pipe` module is > logical > > > > > > > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/b08a7b47-8a49-4add-a924-be4a50a659a9%40googlegroups.com.
