From 372633c5104e078dd7c4643e923c4d94558a72fb Mon Sep 17 00:00:00 2001 From: Adelbert Chang Date: Sun, 27 Mar 2016 18:22:31 -0700 Subject: [PATCH] Rename Id instances to idInstances to make selective import easier, fixes #945 --- core/src/main/scala/cats/package.scala | 2 +- tests/src/test/scala/cats/tests/InjectTests.scala | 6 +++--- .../scala/cats/tests/NaturalTransformationTests.scala | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/main/scala/cats/package.scala b/core/src/main/scala/cats/package.scala index fa7b86f1e4..393ecc7004 100644 --- a/core/src/main/scala/cats/package.scala +++ b/core/src/main/scala/cats/package.scala @@ -26,7 +26,7 @@ package object cats { * encodes pure unary function application. */ type Id[A] = A - implicit val Id: Bimonad[Id] with Traverse[Id] = + implicit val idInstances: Bimonad[Id] with Traverse[Id] = new Bimonad[Id] with Traverse[Id] { def pure[A](a: A): A = a def extract[A](a: A): A = a diff --git a/tests/src/test/scala/cats/tests/InjectTests.scala b/tests/src/test/scala/cats/tests/InjectTests.scala index 6887e84aa6..d174180d9c 100644 --- a/tests/src/test/scala/cats/tests/InjectTests.scala +++ b/tests/src/test/scala/cats/tests/InjectTests.scala @@ -41,13 +41,13 @@ class InjectTests extends CatsSuite { object Test1Interpreter extends (Test1Algebra ~> Id) { override def apply[A](fa: Test1Algebra[A]): Id[A] = fa match { - case Test1(k, h) => Id.pure[A](h(k)) + case Test1(k, h) => h(k) } } object Test2Interpreter extends (Test2Algebra ~> Id) { override def apply[A](fa: Test2Algebra[A]): Id[A] = fa match { - case Test2(k, h) => Id.pure[A](h(k)) + case Test2(k, h) => h(k) } } @@ -65,7 +65,7 @@ class InjectTests extends CatsSuite { b <- Free.inject[Test2Algebra, F](Test2(y, identity)) } yield a + b } - (res[T] foldMap coProductInterpreter) == Id.pure(x + y) should ===(true) + (res[T] foldMap coProductInterpreter) == (x + y) should ===(true) } } diff --git a/tests/src/test/scala/cats/tests/NaturalTransformationTests.scala b/tests/src/test/scala/cats/tests/NaturalTransformationTests.scala index 4a70916c91..b46fa0026b 100644 --- a/tests/src/test/scala/cats/tests/NaturalTransformationTests.scala +++ b/tests/src/test/scala/cats/tests/NaturalTransformationTests.scala @@ -29,11 +29,11 @@ class NaturalTransformationTests extends CatsSuite { case class Test2[A](v : A) extends Test2Algebra[A] object Test1NT extends (Test1Algebra ~> Id) { - override def apply[A](fa: Test1Algebra[A]): Id[A] = Id.pure(fa.v) + override def apply[A](fa: Test1Algebra[A]): Id[A] = fa.v } object Test2NT extends (Test2Algebra ~> Id) { - override def apply[A](fa: Test2Algebra[A]): Id[A] = Id.pure(fa.v) + override def apply[A](fa: Test2Algebra[A]): Id[A] = fa.v } type T[A] = Coproduct[Test1Algebra, Test2Algebra, A] @@ -61,8 +61,8 @@ class NaturalTransformationTests extends CatsSuite { test("or") { val combinedInterpreter = Test1NT or Test2NT forAll { (a : Int, b : Int) => - combinedInterpreter(Coproduct.left(Test1(a))) should === (Id.pure(a)) - combinedInterpreter(Coproduct.right(Test2(b))) should === (Id.pure(b)) + combinedInterpreter(Coproduct.left(Test1(a))) should === (a) + combinedInterpreter(Coproduct.right(Test2(b))) should === (b) } } }