Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vpavkin
Copy link
Contributor

@vpavkin vpavkin commented Mar 12, 2020

Ticks reject/rejectM in #2077

Copy link
Contributor

@adamgfraser adamgfraser left a 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] =
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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!

@vpavkin vpavkin requested a review from adamgfraser March 12, 2020 10:41
Copy link
Contributor

@adamgfraser adamgfraser left a 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!

@adamgfraser adamgfraser merged commit 26f3f69 into zio:master Mar 12, 2020
@vpavkin vpavkin deleted the reject-managed branch March 12, 2020 11:56
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