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
Add andTee() implementation #445
Comments
Currently I'm running the snippet below. A
The |
I see, so there can be two version of tees, one which allows passing errors to downstream and the other which does not care about the error. |
Hi @mheinzerling, I made a PR as I said, and I implemented |
Hi @supermacro and all the contributors, I love neverthrow, thank you for this great library!
In the ideal functional world, we don't want side-effects but in reality, we do need to handle side effects. When we do so, it is usually a good idea to separate pure functions from side effect functions cleanly. And in some of those cases, you want to use the result of the previous computation after you call a side effect function. Of course we can do so with the current API, too, but it would be sleek if we have something like
andTee()
which we would be able to use as follows:or perhaps for logging
The potential signature would be:
There might be better naming than "tee".
I found this library just about a month ago so hopefully I'm not missing anything.
I will be happy to make a PR if this idea sounds a good addition :)
[Edit]
I was looking at tests and got inspiration after seeing
asyncMap
and updated the contents above.The text was updated successfully, but these errors were encountered: