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

Documentation for new Plain-functions feature #158

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

gustavoguichard
Copy link
Collaborator

No description provided.

Copy link
Contributor

@diogob diogob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +163 to +166
### 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:
Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Contributor

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.

@gustavoguichard gustavoguichard merged commit c63a18d into tagged-composable Jun 27, 2024
1 check passed
@gustavoguichard gustavoguichard deleted the documentation-on-plain-fns branch June 27, 2024 14:59
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

Successfully merging this pull request may close these issues.

2 participants