-
Notifications
You must be signed in to change notification settings - Fork 14
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
Documentation for new Plain-functions feature #158
Documentation for new Plain-functions feature #158
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### Transforming the output (mapping) | ||
|
||
Sometimes we want to use a simple function in this sort of sequential composition. Imagine that `toString` is not a composable, and you just want to apply a plain old function to the result of `add` when it succeeds. | ||
The function `map` can be used for this, since we are mapping over the result of a `Composable`: | ||
Sometimes we want to use a simple function to transform the output of another function. Imagine you want to apply a plain old function to the result of `add` when it succeeds. | ||
The function `map` can be used for this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we will eventually have assign map
a different raison d'être since there are several cases now where you could just use pipe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thought about it yesterday but here follows the differences:
- pipe accepts many functions
- map passes the input to the second function
- map infers the arguments of second function while you've got to declare them in pipe
Having thought about that I believe there are places for both to coexist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do believe there is, and I find map is probably going to be a very convenient way to transform output. We have, however, to find a good concept to encapsulate the differences you have pointed out to use in the docs.
No description provided.