From 4fafcf1e38d92a13c727d170b4e9f9d928da247c Mon Sep 17 00:00:00 2001 From: David Strawn Date: Mon, 10 Jun 2024 14:49:44 -0500 Subject: [PATCH] Change implicit ordering to match Chain --- .../main/scala/cats/data/NonEmptyVector.scala | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/core/src/main/scala/cats/data/NonEmptyVector.scala b/core/src/main/scala/cats/data/NonEmptyVector.scala index 65225ec534..21f0d403e6 100644 --- a/core/src/main/scala/cats/data/NonEmptyVector.scala +++ b/core/src/main/scala/cats/data/NonEmptyVector.scala @@ -593,26 +593,6 @@ sealed abstract private[data] class NonEmptyVectorInstances extends NonEmptyVect } -sealed abstract private[data] class NonEmptyVectorInstances0 extends NonEmptyVectorInstances1 { - implicit def catsDataHashForNonEmptyVector[A: Hash]: Hash[NonEmptyVector[A]] = - new Hash[NonEmptyVector[A]] { - override def hash(x: NonEmptyVector[A]): Int = - Hash[Vector[A]].hash(x.toVector) - - override def eqv(x: NonEmptyVector[A], y: NonEmptyVector[A]): Boolean = - Hash[Vector[A]].eqv(x.toVector, y.toVector) - } -} - -sealed abstract private[data] class NonEmptyVectorInstances1 extends NonEmptyVectorInstances2 { - implicit def catsDataPartialOrderForNonEmptyVector[A: PartialOrder]: PartialOrder[NonEmptyVector[A]] = - PartialOrder.by[NonEmptyVector[A], Vector[A]](_.toVector) -} - -sealed abstract private[data] class NonEmptyVectorInstances2 { - implicit def catsDataEqForNonEmptyVector[A: Eq]: Eq[NonEmptyVector[A]] = _ === _ -} - object NonEmptyVector extends NonEmptyVectorInstances with Serializable { def apply[A](head: A, tail: Vector[A]): NonEmptyVector[A] = @@ -661,3 +641,17 @@ object NonEmptyVector extends NonEmptyVectorInstances with Serializable { implicit def catsDataEqForZipNonEmptyVector[A: Eq]: Eq[ZipNonEmptyVector[A]] = Eq.by(_.value) } } + +sealed abstract private[data] class NonEmptyVectorInstances0 extends NonEmptyVectorInstances1 { + implicit def catsDataPartialOrderForNonEmptyVector[A: PartialOrder]: PartialOrder[NonEmptyVector[A]] = + PartialOrder.by[NonEmptyVector[A], Vector[A]](_.toVector) +} + +sealed abstract private[data] class NonEmptyVectorInstances1 extends NonEmptyVectorInstances2 { + implicit def catsDataHashForNonEmptyVector[A: Hash]: Hash[NonEmptyVector[A]] = + Hash.by(_.toVector) +} + +sealed abstract private[data] class NonEmptyVectorInstances2 { + implicit def catsDataEqForNonEmptyVector[A: Eq]: Eq[NonEmptyVector[A]] = _ === _ +}