Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IHNFIWIWD] The compose function is executed left to right #117

Closed
cullylarson opened this issue Jan 20, 2017 · 5 comments
Closed

[IHNFIWIWD] The compose function is executed left to right #117

cullylarson opened this issue Jan 20, 2017 · 5 comments

Comments

@cullylarson
Copy link

It's pretty unusual behavior for compose to execute left to right. Every other compose implementation I've come across executes right to left. One other issues is that this behavior isn't documented in docs/functional-php.md

@lstrojny
Copy link
Owner

Indeed, that was a mistake when implementing it but it’s probably too late to fix that now in a sane way. The only way I would see is adding a function with a different name to do the right thing.

@cullylarson
Copy link
Author

Ah, yeah, that's a tough one. A good solution might be to just be very explicit about that functionality in the documentation. I only noticed it was happening after spending some time trying to debug a function that was using compose, and then looking at the code for compose. I actually had to go back and change all of my other uses of compose.

@MarcoWorms
Copy link

Is it too harmful to break the current interface and make compose do right-to-left composition which would be the expected behaviour and add a pipe function that does the current left-to-right composition? Ramda (https://github.com/ramda/ramda) does it this way and it seems really sane.

@lstrojny
Copy link
Owner

lstrojny commented May 9, 2017

@MarcoWorms I wouldn’t wanna do this for 1.x but I could very well imagine doing this for 2.x.

@lstrojny
Copy link
Owner

lstrojny commented May 9, 2017

Will be addressed with 2.0

@lstrojny lstrojny changed the title The compose function is executed left to right [IHNFIWIWD] The compose function is executed left to right May 9, 2017
@lstrojny lstrojny closed this as completed Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants