diff --git a/project/KernelBoiler.scala b/project/KernelBoiler.scala index 69a46537fe..bb5553ccd8 100644 --- a/project/KernelBoiler.scala +++ b/project/KernelBoiler.scala @@ -147,13 +147,13 @@ object KernelBoiler { - implicit def tuple${arity}Order[${`A..N`}](implicit ${constraints("Order")}): Order[${`(A..N)`}] = - new Order[${`(A..N)`}] { - def compare(x: ${`(A..N)`}, y: ${`(A..N)`}): Int = - - ${binMethod("compare").find(_ != 0).getOrElse(0)} + - ${binMethod("compare").mkString("Array(", ", ", ")")}.find(_ != 0).getOrElse(0) - } - - implicit def tuple${arity}PartialOrder[${`A..N`}](implicit ${constraints("PartialOrder")}): PartialOrder[${`(A..N)`}] = - new PartialOrder[${`(A..N)`}] { - def partialCompare(x: ${`(A..N)`}, y: ${`(A..N)`}): Double = - - ${binMethod("partialCompare").find(_ != 0.0).getOrElse(0.0)} + - ${binMethod("partialCompare").mkString("Array(", ", ", ")")}.find(_ != 0.0).getOrElse(0.0) - } - - implicit def tuple${arity}Semigroup[${`A..N`}](implicit ${constraints("Semigroup")}): Semigroup[${`(A..N)`}] = diff --git a/tests/src/test/scala/cats/tests/TupleTests.scala b/tests/src/test/scala/cats/tests/TupleTests.scala index fdde8f5545..8dab6e68af 100644 --- a/tests/src/test/scala/cats/tests/TupleTests.scala +++ b/tests/src/test/scala/cats/tests/TupleTests.scala @@ -7,6 +7,19 @@ class TupleTests extends CatsSuite { checkAll("Tuple2", BitraverseTests[Tuple2].bitraverse[Option, Int, Int, Int, String, String, String]) checkAll("Bitraverse[Tuple2]", SerializableTests.serializable(Bitraverse[Tuple2])) + test("eqv") { + val eq = Eq[(Int, Long)] + forAll { t: (Int, Long) => eq.eqv(t, t) should === (true) } + forAll { t: (Int, Long) => eq.eqv(t, t._1 -> (t._2 + 1)) should === (false) } + } + + test("order") { + forAll { t: (Int, Int) => + val u = t.swap + Order[(Int, Int)].compare(t, u) should === (scala.math.Ordering[(Int, Int)].compare(t, u)) + } + } + test("show") { (1, 2).show should === ("(1,2)")