reason icon indicating copy to clipboard operation
reason copied to clipboard

Missing explanation about composition operators

Open Wykks opened this issue 5 years ago • 0 comments

I read through https://reasonml.github.io/docs/ ("Language Basics") for the first time and got confused about |> operator.

This operator is mentioned for the first time here : https://reasonml.github.io/docs/en/pipe-first#js-method-chaining

We also cannot use the |> operator here, since the object comes first in the binding. But -> works!

But I have no idea about what this operator is all about... yet

Then here https://reasonml.github.io/docs/en/promise#usage we are invited to look up in the Pervasive api doc to learn about this "Composition operator".

Which contains this description :

Reverse-application operator: x |> f |> g is exactly equivalent to g (f (x)).

Wait.. What's the difference with '->' then ?

Stackoverflow to the rescue : https://stackoverflow.com/questions/55474593/whats-the-difference-between-and-in-reasonml

I think that this should be in the official doc :)

Wykks avatar Feb 04 '20 10:02 Wykks