-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement traverseTap #3647
Implement traverseTap #3647
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.
I like it 👍
my personal opinion is that each function like this should be added to the laws, and the law is just a duplication of the implementation. That way, if someone overrides to make a more optimized version, we have a law that it behaves exactly as the direct implementation. |
That make sense. Implemented in https://github.com/typelevel/cats/pull/3647/files#diff-5ee4897e7202dfd0b4fd61f8afac00bbc7a9b28dc9309b3006f3ffc12b2cd36eR55. Couldn't find a better name for this law. |
this is great! Unfortunately, we also need to add a line here:
to actually call this code when the tests are run. |
Thank you for pointing this out @johnynek. Sorry I've missed that, I'm not yet familiar enough with the project. |
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.
Thanks! This looks useful for logging.
Had to make one more push to avoid breaking binary compatibility in laws |
laws/src/main/scala/cats/laws/discipline/NonEmptyTraverseTests.scala
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #3647 +/- ##
=======================================
Coverage 90.24% 90.25%
=======================================
Files 391 391
Lines 8855 8863 +8
Branches 256 248 -8
=======================================
+ Hits 7991 7999 +8
Misses 864 864 |
I'd like to introduce
traverseTap
. I found it would be useful for me when attempting to perform debug log executing an effect, but dropping the result.I'd like to add some tests, could someone please advice the best place to add them?