-
Notifications
You must be signed in to change notification settings - Fork 532
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
Make IO.Par's applicative commutative #472
Conversation
This may be problematic. That said I thought that in a relationship like |
Maybe Mima complains because the upgrade is in |
Maybe... I'll look into it. Is the general idea OK? |
I think so, but we need an answer for the Mima issue. Not sure what we can do to find out. Maybe do a simulation with such an update attempted on just an |
Alright, finally got around to it. Looks like it is indeed incompatible. Here's what I did (just to make sure I did the right thing):
object IO extends IOInstances
trait Animal
class Dog extends Animal
trait IOInstances {
def instance: Animal = new Dog
}
object Usage extends App {
val a: Animal = IO.instance
println(a)
}
Then I changed the line in IOInstances: - def instance: Animal = new Dog
+ def instance: Dog = new Dog Recompiled java.lang.NoSuchMethodError: IO$.instance()LAnimal;
at Usage$.delayedEndpoint$Usage$1(User.scala:2)
at Usage$delayedInit$body.apply(User.scala:1)
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at scala.Function0.apply$mcV$sp$(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.App.$anonfun$main$1$adapted(App.scala:80)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.App.main(App.scala:80)
at scala.App.main$(App.scala:78)
at Usage$.main(User.scala:1)
at Usage.main(User.scala) I suppose we would need to add a new method that returns a more specific type ( |
12ee40b
to
49b513d
Compare
I submitted a workaround in the latest commit, basically moving the instance as explicit to the |
Codecov Report
@@ Coverage Diff @@
## master #472 +/- ##
==========================================
+ Coverage 89.6% 89.76% +0.15%
==========================================
Files 70 70
Lines 2050 2052 +2
Branches 196 196
==========================================
+ Hits 1837 1842 +5
+ Misses 213 210 -3 |
Apparently MiMa claims this is binary incompatible, but maybe it's a false positive (the trait is
private[effect]
so maybe it only matters for implementations), so I submitted it anyway.Please let me know what you think about making IO.Par's applicative commutative (I checked it before and it passed the laws... apparently)