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

Move catsTraverseForSeq to lower-priority implicit scope #4373

Merged
merged 4 commits into from
Jan 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions core/src/main/scala/cats/UnorderedFoldable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,13 @@ trait UnorderedFoldable[F[_]] extends Serializable {
unorderedFoldMap(fa)(a => if (p(a)) 1L else 0L)
}

trait LowPriorityImplicits {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trait LowPriorityImplicits {
private trait UnorderedFoldableLowPriority {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw (late) that it couldn't be used later if it was private: private trait UnorderedFoldableLowPriority escapes its defining scope as part of type cats.UnorderedFoldableLowPriority
I changed it to protected, I think it makes sense, what do you think?

implicit def catsTraverseForSeq: Traverse[Seq] = cats.instances.seq.catsStdInstancesForSeq
}

object UnorderedFoldable
extends ScalaVersionSpecificTraverseInstances
with cats.instances.NTupleUnorderedFoldableInstances {
with cats.instances.NTupleUnorderedFoldableInstances with LowPriorityImplicits{

private val orEvalMonoid: CommutativeMonoid[Eval[Boolean]] = new CommutativeMonoid[Eval[Boolean]] {
val empty: Eval[Boolean] = Eval.False
Expand All @@ -125,7 +129,6 @@ object UnorderedFoldable
implicit def catsNonEmptyTraverseForId: NonEmptyTraverse[Id] = catsInstancesForId
implicit def catsTraverseForOption: Traverse[Option] = cats.instances.option.catsStdInstancesForOption
implicit def catsTraverseForList: Traverse[List] = cats.instances.list.catsStdInstancesForList
implicit def catsTraverseForSeq: Traverse[Seq] = cats.instances.seq.catsStdInstancesForSeq
implicit def catsTraverseForVector: Traverse[Vector] = cats.instances.vector.catsStdInstancesForVector
implicit def catsTraverseForQueue: Traverse[Queue] = cats.instances.queue.catsStdInstancesForQueue
implicit def catsUnorderedTraverseForSet: UnorderedTraverse[Set] = cats.instances.set.catsStdInstancesForSet
Expand Down