Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use case
This fits a similar use case as the passthrough proposed on #96
It can be used to add validation functions to a pipeline that should abort execution on error but don't necessarly produce a result that we want to pipe to the next callee.
For instance, let's say you want to check the state of a record in the database and send a notification only when the validation function is successful.
In this case the resulting type of the validation function should not be taken into account, since you don't want to write the function for the composition.
With the new combinator something like this could be done:
It also makes it easier to reuse existing functions just for the sake of their side-effects. On the previous example, let's say you want add a function that records a log of messages sent on the database (and fail to send the message in case the log fails).
I was hoping to merge this before we have the full composable documentation.
TODO