-
Couldn't load subscription status.
- Fork 1.4k
Port reject/rejectM to ZManaged #3109
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
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.
Looks great! Just need to fix one thing.
| * Fail with the returned value if the `PartialFunction` matches, otherwise | ||
| * continue with our held value. | ||
| */ | ||
| def reject[R1 <: R, E1 >: E](pf: PartialFunction[A, E1]): ZManaged[R1, E1, A] = |
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.
You can delete the R1 type parameter here since you aren't using it anywhere. The partial function doesn't use an environment so the environmental requirements of the new effect will be the same as those of the original effect.
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.
Looks like the same issue is present in the implementations for ZIO and ZSTM. You want to fix there as well?
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.
Yeah, I shouldn't have blindly copied that parameter 🤦♂️ .
Good catch.
WRT to ZIO and ZSTM, this might break explicitly annotated user calls, are we ok with it?
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.
No worries! That is why we do these reviews. Yes we are okay with breaking compatibility at this point. I highly doubt there is significant usage with annotations, users will be glad to not have to specify an extra type parameter if they do have to, and now is the time to make these changes before we release 1.0 and have to ensure binary compatibility. Good question though!
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.
Nice work adding new functionality and leaving the code base better than you found it! Congratulations on your first contribution to ZIO!
Ticks reject/rejectM in #2077