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

Fix more bincompat breakage #3203

Merged
merged 3 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 5 additions & 6 deletions core/src/main/scala/cats/instances/sortedSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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])
kailuowang marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
8 changes: 8 additions & 0 deletions laws/src/main/scala/cats/laws/MonadErrorLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
kailuowang marked this conversation as resolved.
Show resolved Hide resolved
}

object MonadErrorLaws {
Expand Down