From 654257ae0f036fc30e878e4dcdf1cd6b42c686a5 Mon Sep 17 00:00:00 2001 From: Kailuo Wang Date: Sun, 24 Apr 2016 08:04:22 -0400 Subject: [PATCH] updated to Algebra 0.4.0 --- build.sbt | 4 ++-- core/src/main/scala/cats/data/WriterT.scala | 2 -- laws/src/main/scala/cats/laws/discipline/Eq.scala | 13 +++---------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/build.sbt b/build.sbt index e0f4d915ab6..8d691acae93 100644 --- a/build.sbt +++ b/build.sbt @@ -33,8 +33,8 @@ lazy val commonSettings = Seq( ), libraryDependencies ++= Seq( "com.github.mpilquist" %%% "simulacrum" % "0.7.0", - "org.spire-math" %%% "algebra" % "0.3.1", - "org.spire-math" %%% "algebra-std" % "0.3.1", + "org.spire-math" %%% "algebra" % "0.4.0", + "org.spire-math" %%% "algebra-std" % "0.4.0", "org.typelevel" %%% "machinist" % "0.4.1", compilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.full), compilerPlugin("org.spire-math" %% "kind-projector" % "0.6.3") diff --git a/core/src/main/scala/cats/data/WriterT.scala b/core/src/main/scala/cats/data/WriterT.scala index 8d21fbf1b56..3e0ecae6edc 100644 --- a/core/src/main/scala/cats/data/WriterT.scala +++ b/core/src/main/scala/cats/data/WriterT.scala @@ -53,8 +53,6 @@ private[data] sealed abstract class WriterTInstances extends WriterTInstances0 { implicit def writerTIdMonad[L:Monoid]: Monad[WriterT[Id, L, ?]] = writerTMonadWriter[Id, L] - // The Eq[(L, V)] can be derived from an Eq[L] and Eq[V], but we are waiting - // on an algebra release that includes /~https://github.com/non/algebra/pull/82 implicit def writerTIdEq[L, V](implicit E: Eq[(L, V)]): Eq[WriterT[Id, L, V]] = writerTEq[Id, L, V] diff --git a/laws/src/main/scala/cats/laws/discipline/Eq.scala b/laws/src/main/scala/cats/laws/discipline/Eq.scala index 730822231d6..2a679a697ad 100644 --- a/laws/src/main/scala/cats/laws/discipline/Eq.scala +++ b/laws/src/main/scala/cats/laws/discipline/Eq.scala @@ -4,6 +4,7 @@ package discipline import catalysts.Platform import algebra.Eq +import algebra.std.tuple import cats.std.string._ import org.scalacheck.Arbitrary @@ -31,17 +32,9 @@ object eq { (a: A) => showInstance.show(a) } - // Temporary, see /~https://github.com/non/algebra/pull/82 - implicit def tuple2Eq[A, B](implicit A: Eq[A], B: Eq[B]): Eq[(A, B)] = - new Eq[(A, B)] { - def eqv(x: (A, B), y: (A, B)): Boolean = - A.eqv(x._1, y._1) && B.eqv(x._2, y._2) - } + implicit def tuple2Eq[A, B](implicit A: Eq[A], B: Eq[B]): Eq[(A, B)] = tuple.tuple2Eq - implicit def tuple3Eq[A, B, C](implicit EqA: Eq[A], EqB: Eq[B], EqC: Eq[C]): Eq[(A, B, C)] = - new Eq[(A, B, C)] { - def eqv(x: (A, B, C), y: (A, B, C)): Boolean = EqA.eqv(x._1, y._1) && EqB.eqv(x._2, y._2) && EqC.eqv(x._3, y._3) - } + implicit def tuple3Eq[A, B, C](implicit EqA: Eq[A], EqB: Eq[B], EqC: Eq[C]): Eq[(A, B, C)] = tuple.tuple3Eq /** * Create an approximation of Eq[Semigroup[A]] by generating values for A