Stream: ideas

Topic: Reverse Pipe Operator


view this post on Zulip Rob (Aug 23 2022 at 15:09):

Sorry if this has been discussed already. I tried searching the Github issues and the Zulip chat history and didn't get any results.

Are there any plans on adding the reverse pipe like in Elm? This would be in lieu of parens in some cases. A trivial example would be

Stdout.line <| Str.concat "hello" <|  Num.toStr 50

view this post on Zulip Anton (Aug 23 2022 at 15:12):

Hi Rob, this is mentioned in the FAQ but we should take some steps to make the FAQ easier to find :)

No <| operator. In Elm, I almost exclusively found myself wanting to use this in conjunction with anonymous functions (e.g. foo <| \bar -> ...) or conditionals (e.g. foo <| if bar then ...). In Roc you can do both of these without the <|. That means the main remaining use for <| is to reduce parentheses, but I tend to think |> is better at that (or else the parens are fine), so after the other syntactic changes, I considered <| an unnecessary stylistic alternative to |> or parens.

view this post on Zulip Anton (Aug 23 2022 at 15:26):

I've put up a PR that links to "frequently asked questions" from the main README


Last updated: Jun 16 2026 at 16:19 UTC