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

Move Id instances into implicit scope for Scala 3 #3906

Merged
merged 1 commit into from
May 30, 2021
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
4 changes: 3 additions & 1 deletion core/src/main/scala/cats/Invariant.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ import scala.util.control.TailCalls.TailRec

@suppressUnusedImportWarningForScalaVersionSpecific
object Invariant extends ScalaVersionSpecificInvariantInstances with InvariantInstances0 {
implicit def catsInstancesForId: Distributive[Id] with Comonad[Id] = cats.catsInstancesForId
implicit def catsInstancesForId
: Distributive[Id] with Bimonad[Id] with CommutativeMonad[Id] with NonEmptyTraverse[Id] =
cats.catsInstancesForId
implicit def catsMonadErrorForEither[A]: MonadError[Either[A, *], A] =
cats.instances.either.catsStdInstancesForEither[A]
implicit def catsInstancesForOption
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ package object cats {
*/
type Id[A] = A
type Endo[A] = A => A
implicit val catsInstancesForId
: Bimonad[Id] with CommutativeMonad[Id] with Comonad[Id] with NonEmptyTraverse[Id] with Distributive[Id] =
new Bimonad[Id] with CommutativeMonad[Id] with Comonad[Id] with NonEmptyTraverse[Id] with Distributive[Id] {

val catsInstancesForId: Bimonad[Id] with CommutativeMonad[Id] with NonEmptyTraverse[Id] with Distributive[Id] =
new Bimonad[Id] with CommutativeMonad[Id] with NonEmptyTraverse[Id] with Distributive[Id] {
def pure[A](a: A): A = a
def extract[A](a: A): A = a
def flatMap[A, B](a: A)(f: A => B): B = f(a)
Expand Down
1 change: 0 additions & 1 deletion free/src/test/scala/cats/free/FreeApplicativeSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import cats.syntax.eq._
import org.scalacheck.Prop._
import cats.tests.CatsSuite
import org.scalacheck.{Arbitrary, Gen}
import cats._

class FreeApplicativeSuite extends CatsSuite {
import FreeApplicativeSuite._
Expand Down
4 changes: 1 addition & 3 deletions laws/src/main/scala/cats/laws/NonEmptyTraverseLaws.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cats.laws

// The `catsInstancesForId` import is necessary to work around a Dotty
// issue related to https://github.com/lampepfl/dotty/issues/9067.
import cats.{catsInstancesForId, Apply, Id, NonEmptyTraverse, Semigroup}
import cats.{Apply, Id, NonEmptyTraverse, Semigroup}
import cats.data.{Const, Nested}
import cats.syntax.nonEmptyTraverse._
import cats.syntax.reducible._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import cats.syntax.parallel._
import cats.syntax.traverse._
import cats.syntax.eq._
import org.scalacheck.Prop._
import cats.catsInstancesForId
import cats.kernel.{Eq, Order}
import cats.laws.discipline.eq._

Expand Down
1 change: 0 additions & 1 deletion tests/src/test/scala/cats/tests/IdSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cats.tests

import cats.{Bimonad, CommutativeMonad, Id, Reducible, Traverse}
import cats.laws.discipline._
import cats.catsInstancesForId

class IdSuite extends CatsSuite {
implicit val iso: SemigroupalTests.Isomorphisms[Id] =
Expand Down
1 change: 0 additions & 1 deletion tests/src/test/scala/cats/tests/MonadSuite.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cats.tests

import cats.{Eval, Id, Monad}
import cats.catsInstancesForId
import cats.data.{IndexedStateT, StateT}
import cats.syntax.apply._
import cats.syntax.monad._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import cats.Id
import cats.syntax.unorderedTraverse._
import cats.syntax.eq._
import org.scalacheck.Prop._
import cats.catsInstancesForId

class UnorderedTraverseSuite extends CatsSuite {
test("UnorderedTraverse[Set[Int]].unorderedTraverse via syntax") {
Expand Down