Skip to content

Commit

Permalink
Merge pull request #955 from adelbertc/rename-id-instances
Browse files Browse the repository at this point in the history
Rename Id instances to idInstances to make selective import easier, f…
  • Loading branch information
stew committed Apr 1, 2016
2 parents 08d843d + 372633c commit e49b2be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/src/test/scala/cats/tests/InjectTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
}
}
}

0 comments on commit e49b2be

Please sign in to comment.