Skip to content

Commit

Permalink
Completed Comonad tests using tuple instead of Const
Browse files Browse the repository at this point in the history
  • Loading branch information
barambani committed Mar 7, 2018
1 parent 4cf8304 commit 0c2c002
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
12 changes: 1 addition & 11 deletions core/src/main/scala/cats/data/Const.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private[data] sealed abstract class ConstInstances0 extends ConstInstances1 {
}
}

private[data] sealed abstract class ConstInstances1 extends ConstInstances2 {
private[data] sealed abstract class ConstInstances1 {

implicit def catsDataEqForConst[A: Eq, B]: Eq[Const[A, B]] = new Eq[Const[A, B]] {
def eqv(x: Const[A, B], y: Const[A, B]): Boolean =
Expand All @@ -152,13 +152,3 @@ private[data] sealed abstract class ConstInstances1 extends ConstInstances2 {
fa.retag[B]
}
}

private[data] sealed abstract class ConstInstances2 {

implicit def catsDataComonadForConst[C]: Comonad[Const[C, ?]] =
new Comonad[Const[C, ?]] {
def coflatMap[A, B](fa: Const[C,A])(f: Const[C,A] => B): Const[C,B] = ???
def extract[A](x: Const[C,A]): A = ???
def map[A, B](fa: Const[C,A])(f: A => B): Const[C,B] = ???
}
}
6 changes: 3 additions & 3 deletions tests/src/test/scala/cats/tests/WriterTSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ class WriterTSuite extends CatsSuite {
{
// F has a Comonad and L has a Monoid
implicit val L: Monoid[ListWrapper[Int]] = ListWrapper.monoid[Int]
Comonad[WriterT[Const[String, ?], ListWrapper[Int], ?]]
Comonad[WriterT[(String, ?), ListWrapper[Int], ?]]

checkAll("WriterT[Const[String, ?], ListWrapper[Int], ?]", ComonadTests[WriterT[Const[String, ?], ListWrapper[Int], ?]].comonad[Int, Int, Int])
checkAll("Comonad[WriterT[Const[String, ?], ListWrapper[Int], ?]]", SerializableTests.serializable(Comonad[WriterT[Const[String, ?], ListWrapper[Int], ?]]))
checkAll("WriterT[(String, ?), ListWrapper[Int], ?]", ComonadTests[WriterT[(String, ?), ListWrapper[Int], ?]].comonad[Int, Int, Int])
checkAll("Comonad[WriterT[(String, ?), ListWrapper[Int], ?]]", SerializableTests.serializable(Comonad[WriterT[(String, ?), ListWrapper[Int], ?]]))
}

checkAll("WriterT[Option, Int, ?]", CommutativeMonadTests[WriterT[Option, Int, ?]].commutativeMonad[Int, Int, Int])
Expand Down

0 comments on commit 0c2c002

Please sign in to comment.