From befb456d59c478c54a7771ec40dc2f2763067c12 Mon Sep 17 00:00:00 2001 From: Travis Brown Date: Thu, 22 Aug 2019 08:21:16 -0500 Subject: [PATCH 1/4] Fix instance name --- core/src/main/scala/cats/data/Op.scala | 6 +++++- tests/src/test/scala/cats/tests/OpSuite.scala | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/cats/data/Op.scala b/core/src/main/scala/cats/data/Op.scala index 4613075d9d..c31783789d 100644 --- a/core/src/main/scala/cats/data/Op.scala +++ b/core/src/main/scala/cats/data/Op.scala @@ -20,8 +20,12 @@ sealed abstract private[data] class OpInstances extends OpInstances0 { implicit def catsDataCategoryForOp[Arr[_, _]](implicit ArrC: Category[Arr]): Category[Op[Arr, *, *]] = new OpCategory[Arr] { def Arr: Category[Arr] = ArrC } - implicit def catsKernelEqForOp[Arr[_, _], A, B](implicit ArrEq: Eq[Arr[B, A]]): Eq[Op[Arr, A, B]] = + implicit def catsDataEqForOp[Arr[_, _], A, B](implicit ArrEq: Eq[Arr[B, A]]): Eq[Op[Arr, A, B]] = new OpEq[Arr, A, B] { def Arr: Eq[Arr[B, A]] = ArrEq } + + @deprecated("2.0.0-RC2", "Use catsDataEqForOp") + private[data] def catsKernelEqForOp[Arr[_, _], A, B](implicit ArrEq: Eq[Arr[B, A]]): Eq[Op[Arr, A, B]] = + catsDataEqForOp[Arr, A, B] } sealed abstract private[data] class OpInstances0 { diff --git a/tests/src/test/scala/cats/tests/OpSuite.scala b/tests/src/test/scala/cats/tests/OpSuite.scala index a533c6e0e1..13e89afa25 100644 --- a/tests/src/test/scala/cats/tests/OpSuite.scala +++ b/tests/src/test/scala/cats/tests/OpSuite.scala @@ -10,7 +10,7 @@ import cats.kernel.laws.discipline.EqTests class OpSuite extends CatsSuite { { - implicit val catsKernelEqForOp = Op.catsKernelEqForOp[Function1, Int, MiniInt] + implicit val catsDataEqForOp = Op.catsDataEqForOp[Function1, Int, MiniInt] checkAll("Op[Function1, Int, MiniInt]", EqTests[Op[Function1, Int, MiniInt]].eqv) checkAll("Eq[Op[Function1, Int, MiniInt]]", SerializableTests.serializable(Eq[Op[Function1, Int, MiniInt]])) } From 3b6e98cebd31733d09c9df626be47f93d1551308 Mon Sep 17 00:00:00 2001 From: Travis Brown Date: Thu, 22 Aug 2019 11:50:53 -0500 Subject: [PATCH 2/4] Fix ZipNonEmptyX Eq instance names --- core/src/main/scala/cats/data/NonEmptyList.scala | 5 ++++- core/src/main/scala/cats/data/NonEmptyVector.scala | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/cats/data/NonEmptyList.scala b/core/src/main/scala/cats/data/NonEmptyList.scala index 2e3deee961..5a95b83284 100644 --- a/core/src/main/scala/cats/data/NonEmptyList.scala +++ b/core/src/main/scala/cats/data/NonEmptyList.scala @@ -500,7 +500,10 @@ object NonEmptyList extends NonEmptyListInstances { ZipNonEmptyList(fa.value.zipWith(fb.value) { case (a, b) => (a, b) }) } - implicit def zipNelEq[A: Eq]: Eq[ZipNonEmptyList[A]] = Eq.by(_.value) + @deprecated("2.0.0-RC2", "Use catsDataEqForZipNonEmptyList") + private[data] def zipNelEq[A: Eq]: Eq[ZipNonEmptyList[A]] = catsDataEqForZipNonEmptyList[A] + + implicit def catsDataEqForZipNonEmptyList[A: Eq]: Eq[ZipNonEmptyList[A]] = Eq.by(_.value) } } diff --git a/core/src/main/scala/cats/data/NonEmptyVector.scala b/core/src/main/scala/cats/data/NonEmptyVector.scala index c7e5933f61..31d111823c 100644 --- a/core/src/main/scala/cats/data/NonEmptyVector.scala +++ b/core/src/main/scala/cats/data/NonEmptyVector.scala @@ -428,6 +428,9 @@ object NonEmptyVector extends NonEmptyVectorInstances with Serializable { ZipNonEmptyVector(fa.value.zipWith(fb.value) { case (a, b) => (a, b) }) } - implicit def zipNevEq[A: Eq]: Eq[ZipNonEmptyVector[A]] = Eq.by(_.value) + @deprecated("2.0.0-RC2", "Use catsDataEqForZipNonEmptyVector") + private[data] def zipNevEq[A: Eq]: Eq[ZipNonEmptyVector[A]] = catsDataEqForZipNonEmptyVector[A] + + implicit def catsDataEqForZipNonEmptyVector[A: Eq]: Eq[ZipNonEmptyVector[A]] = Eq.by(_.value) } } From c3798cfc0f1264a8aa39741ce0ab2d91868bac72 Mon Sep 17 00:00:00 2001 From: Travis Brown Date: Thu, 22 Aug 2019 10:21:38 -0500 Subject: [PATCH 3/4] Fix guidelines, which manage to be inconsistent in adjacent lines :) --- docs/src/main/tut/guidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/tut/guidelines.md b/docs/src/main/tut/guidelines.md index 6c14ca68dc..ddaa632254 100644 --- a/docs/src/main/tut/guidelines.md +++ b/docs/src/main/tut/guidelines.md @@ -80,7 +80,7 @@ therefore name our implicits according to the following rules: - If the instance is for multiple type classes, use `InstancesFor` instead of a type class name. - If the instance is for a standard library type add `Std` after the package. i.e. `catsStdShowForVector` and `catsKernelStdGroupForTuple`. -As an example, an implicit instance of `Monoid` for `List` defined in the package `Kernel` should be named `catsKernelMonoidForList`. +As an example, an implicit instance of `Monoid` for `List` defined in the package `Kernel` should be named `catsKernelStdMonoidForList`. This rule is relatively flexible. Use what you see appropriate. The goal is to maintain uniqueness and avoid conflicts. From 694d0bbfb214cf58a7d65cd05ed2ebd85d9f456e Mon Sep 17 00:00:00 2001 From: Travis Brown Date: Fri, 23 Aug 2019 10:37:20 -0500 Subject: [PATCH 4/4] Fix deprecation arguments --- core/src/main/scala/cats/data/NonEmptyList.scala | 2 +- core/src/main/scala/cats/data/NonEmptyVector.scala | 2 +- core/src/main/scala/cats/data/Op.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/scala/cats/data/NonEmptyList.scala b/core/src/main/scala/cats/data/NonEmptyList.scala index 5a95b83284..1cf6ea3913 100644 --- a/core/src/main/scala/cats/data/NonEmptyList.scala +++ b/core/src/main/scala/cats/data/NonEmptyList.scala @@ -500,7 +500,7 @@ object NonEmptyList extends NonEmptyListInstances { ZipNonEmptyList(fa.value.zipWith(fb.value) { case (a, b) => (a, b) }) } - @deprecated("2.0.0-RC2", "Use catsDataEqForZipNonEmptyList") + @deprecated("Use catsDataEqForZipNonEmptyList", "2.0.0-RC2") private[data] def zipNelEq[A: Eq]: Eq[ZipNonEmptyList[A]] = catsDataEqForZipNonEmptyList[A] implicit def catsDataEqForZipNonEmptyList[A: Eq]: Eq[ZipNonEmptyList[A]] = Eq.by(_.value) diff --git a/core/src/main/scala/cats/data/NonEmptyVector.scala b/core/src/main/scala/cats/data/NonEmptyVector.scala index 31d111823c..3d63d46558 100644 --- a/core/src/main/scala/cats/data/NonEmptyVector.scala +++ b/core/src/main/scala/cats/data/NonEmptyVector.scala @@ -428,7 +428,7 @@ object NonEmptyVector extends NonEmptyVectorInstances with Serializable { ZipNonEmptyVector(fa.value.zipWith(fb.value) { case (a, b) => (a, b) }) } - @deprecated("2.0.0-RC2", "Use catsDataEqForZipNonEmptyVector") + @deprecated("Use catsDataEqForZipNonEmptyVector", "2.0.0-RC2") private[data] def zipNevEq[A: Eq]: Eq[ZipNonEmptyVector[A]] = catsDataEqForZipNonEmptyVector[A] implicit def catsDataEqForZipNonEmptyVector[A: Eq]: Eq[ZipNonEmptyVector[A]] = Eq.by(_.value) diff --git a/core/src/main/scala/cats/data/Op.scala b/core/src/main/scala/cats/data/Op.scala index c31783789d..a582dc3e6c 100644 --- a/core/src/main/scala/cats/data/Op.scala +++ b/core/src/main/scala/cats/data/Op.scala @@ -23,7 +23,7 @@ sealed abstract private[data] class OpInstances extends OpInstances0 { implicit def catsDataEqForOp[Arr[_, _], A, B](implicit ArrEq: Eq[Arr[B, A]]): Eq[Op[Arr, A, B]] = new OpEq[Arr, A, B] { def Arr: Eq[Arr[B, A]] = ArrEq } - @deprecated("2.0.0-RC2", "Use catsDataEqForOp") + @deprecated("Use catsDataEqForOp", "2.0.0-RC2") private[data] def catsKernelEqForOp[Arr[_, _], A, B](implicit ArrEq: Eq[Arr[B, A]]): Eq[Op[Arr, A, B]] = catsDataEqForOp[Arr, A, B] }