diff --git a/core/src/main/scala/cats/instances/sortedSet.scala b/core/src/main/scala/cats/instances/sortedSet.scala index 99c642d110..36a9652f61 100644 --- a/core/src/main/scala/cats/instances/sortedSet.scala +++ b/core/src/main/scala/cats/instances/sortedSet.scala @@ -92,12 +92,11 @@ private[instances] trait SortedSetInstancesBinCompat0 { } private[instances] trait SortedSetInstancesBinCompat1 extends LowPrioritySortedSetInstancesBinCompat1 { - // TODO: Remove when this is no longer necessary for binary compatibility. - // Note that the overrides here and below are only necessary because the - // definitions in `SortedSetInstances1` conflict with the ones in - // `cats.kernel.instances.SortedSetInstances`. Both are inherited here, so - // we have to "bubble" the "correct" ones up to the appropriate place. - implicit override def catsKernelStdHashForSortedSet[A: Hash]: Hash[SortedSet[A]] = + implicit def catsKernelStdHashForSortedSet1[A: Hash]: Hash[SortedSet[A]] = + cats.kernel.instances.sortedSet.catsKernelStdHashForSortedSet[A](Hash[A]) + + @deprecated("Use cats.kernel.instances.sortedSet.catsKernelStdHashForSortedSet", "2.0.0-RC3") + override def catsKernelStdHashForSortedSet[A: Order: Hash]: Hash[SortedSet[A]] = cats.kernel.instances.sortedSet.catsKernelStdHashForSortedSet[A](Hash[A]) } diff --git a/laws/src/main/scala/cats/laws/MonadErrorLaws.scala b/laws/src/main/scala/cats/laws/MonadErrorLaws.scala index e9b19354bf..c05f029994 100644 --- a/laws/src/main/scala/cats/laws/MonadErrorLaws.scala +++ b/laws/src/main/scala/cats/laws/MonadErrorLaws.scala @@ -19,6 +19,14 @@ trait MonadErrorLaws[F[_], E] extends ApplicativeErrorLaws[F, E] with MonadLaws[ def redeemWithDerivedFromAttemptFlatMap[A, B](fa: F[A], fe: E => F[B], fs: A => F[B]): IsEq[F[B]] = F.redeemWith(fa)(fe, fs) <-> F.flatMap(F.attempt(fa))(_.fold(fe, fs)) + + // See https://github.com/typelevel/cats/pull/3203 for an explanation of why these two overrides + // are needed in 2.x for binary compatibility. + override def adaptErrorPure[A](a: A, f: E => E): IsEq[F[A]] = + F.adaptError(F.pure(a)) { case x => f(x) } <-> F.pure(a) + + override def adaptErrorRaise[A](e: E, f: E => E): IsEq[F[A]] = + F.adaptError(F.raiseError[A](e)) { case x => f(x) } <-> F.raiseError(f(e)) } object MonadErrorLaws {