-
-
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
Add TraverseFilter instance for Queue. #3103
Add TraverseFilter instance for Queue. #3103
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3103 +/- ##
==========================================
- Coverage 93.52% 93.51% -0.02%
==========================================
Files 368 368
Lines 6998 7011 +13
Branches 198 197 -1
==========================================
+ Hits 6545 6556 +11
- Misses 453 455 +2
Continue to review full report at Codecov.
|
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! Now that Scala 2.11 was dropped from master, we no longer need binCompat traits.
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 great! :)
Do we still need the bincompat traits now that we've dropped the binary compatability requirement on 2.11?
Edit: Oh, I'm late.
|
a7f0097
to
f546484
Compare
@@ -152,4 +152,33 @@ trait QueueInstances extends cats.kernel.instances.QueueInstances { | |||
def show(fa: Queue[A]): String = | |||
fa.iterator.map(_.show).mkString("Queue(", ", ", ")") | |||
} | |||
|
|||
implicit def catsStdTraverseFilterForQueue: TraverseFilter[Queue] = QueueInstances.catsStdTraverseFilterForQueue |
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 don't know why , but implicit val catsStdTraverseFilterForQueue
breaks binary compatibility.
[error] * abstract synthetic method cats$instances$QueueInstances$_setter_$catsStdTraverseFilterForQueue_=(cats.TraverseFilter)Unit in interface cats.instances.QueueInstances is present only in current version
[error] filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("cats.instances.QueueInstances.cats$instances$QueueInstances$_setter_$catsStdTraverseFilterForQueue_=")
[error] * abstract method catsStdTraverseFilterForQueue()cats.TraverseFilter in interface cats.instances.QueueInstances is present only in current version
[error] filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("cats.instances.QueueInstances.catsStdTraverseFilterForQueue")
} | ||
|
||
private object QueueInstances { | ||
private val catsStdTraverseFilterForQueue: TraverseFilter[Queue] = new TraverseFilter[Queue] { |
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.
This is just an instance cache.
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 don't see this pattern as problematic but it's not very consistent with rest of the code base, can we just make the one in the trait a val
instead of creating a new object?
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 get an error that
[error] * abstract synthetic method cats$instances$QueueInstances$_setter_$cats$instances$QueueInstances$$_catsStdTraverseFilterForQueue_=(cats.TraverseFilter)Unit in interface cats.instances.QueueInstances is present only in current version
[error] filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("cats.instances.QueueInstances.cats$instances$QueueInstances$_setter_$cats$instances$QueueInstances$$_catsStdTraverseFilterForQueue_=")
[error] * abstract synthetic method cats$instances$QueueInstances$$_catsStdTraverseFilterForQueue()cats.TraverseFilter in interface cats.instances.QueueInstances is present only in current version
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.
how did you run the check? did you get that error from sbt validateBC
?
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.
Yes, I ran sbt validateBC
.
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.
Adding a val
to a trait will break bincompat on all Scala versions so far because of the synthetic setter that's necessary because of the way trait initialization works. The workaround here looks reasonable to me.
No description provided.