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

Rename Id instances to idInstances to make selective import easier, f… #955

Merged
merged 1 commit into from
Apr 1, 2016
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
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)
}
}
}