[erlang-questions] Pipe Operator in Erlang?

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Jul 10 10:48:57 CEST 2015


On Thu, Jul 9, 2015 at 5:24 PM, Volkert <volkert@REDACTED>
wrote:

> Are there any plans to have this in Erlang?


As already noted, the operator |> is hard to add to the language because it
doesn't work that well.

I'd much rather see a succinct notion for a monadic val/bind where I can
set a monad

M = #monad { val = Val, bind = Bind },
with M do
    X <- foo(),
    Y <- bar(X),
    return(Y)
end

and run inside the monad[0]. Since the language is dynamically typed, you
would have to supply the monad you are building over, but you would be able
to do a lot of the things people request with the |> operator, as it is a
special case.

[0] I've given this very little syntactical thought at the moment, but
hopefully you get the idea.


-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150710/9247ce1a/attachment.htm>


More information about the erlang-questions mailing list