Skip to content
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

Fix SemigroupK[Resource[F, *]].combineK #1030

Merged
merged 6 commits into from
Aug 4, 2020
Merged

Fix SemigroupK[Resource[F, *]].combineK #1030

merged 6 commits into from
Aug 4, 2020

Conversation

BalmungSan
Copy link
Contributor

@BalmungSan BalmungSan commented Jul 31, 2020

Changing the behavior of SemigroupK[Resource[F, *]].combineK to be consistent with MonadError[Resource[F, *], E].orElse

Fixes #949


I am surprised I didn't have to change any test (this is probably a sign that there was no reason for the previous behavior).
Should I add some tests for the current behavior?

BTW, I confirmed it worked as expected using the snippet posted in the original issue.

…nsistent with MonadError[Resource[F, *], E].orElse
@BalmungSan
Copy link
Contributor Author

It seems my implementation is not binary compatible.
I could preserve the old class, and still require a SemigroupK for F (even if unneeded).
But still, the new implementation requires a MonadError for F instead of just a Monad... so, it wouldn't matter.

@djspiewak
Copy link
Member

Ah! So the trick to appease the MiMa gods here is to take the old method, remove the implicit modifier and make it private[effect]. It compiles to the same bytecode as what you have there now, but any call sites will recompile to use the new (correct) signature. It's definitely worth doing this, even though the old one was kind of broken and dumb, just to make sure we really hold up the "binary compatible" guarantee. :-)

@BalmungSan
Copy link
Contributor Author

BalmungSan commented Aug 3, 2020

@djspiewak oh good to know, I will make the change.
However, even if it is binary compatible. It is acceptable that using a different jar (that was supposed to be binary compatible) will produce a different runtime behavior? Or in this case, are we considering this a bug fix?

BTW, what do you think about the tests?

@djspiewak
Copy link
Member

However, even if it is binary compatible. It is acceptable that using a different jar (that was supposed to be binary compatible) will produce a different runtime behavior? Or in this case, are we considering this a bug fix?

Well, it's still going to produce the same runtime behavior. You can't call the new implementation from the old signature, so you just have to keep the old implementation around, but hidden behind the private[effect] signature. So that part should be okay.

If we were in the situation you described, I definitely would need to be sure it was a bugfix. :-)

BTW, what do you think about the tests?

I think it's definitely worth adding some tests. It doesn't entirely surprise me that the behavior was previously untested, since I feel like anyone writing such a test would realize how silly the semantics were.

@djspiewak djspiewak merged commit 349983b into typelevel:series/2.x Aug 4, 2020
@BalmungSan BalmungSan deleted the fix-resource-semigroupk-combinek branch August 4, 2020 15:53
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.

Idea: Change the behavior of SemigroupK.combineK for Resource
2 participants