Permalink
Browse files

Update Cats

  • Loading branch information...
travisbrown committed Nov 1, 2017
1 parent 6e04f07 commit a27d9267f2d11a01430a452bdff0eda99382bff9
@@ -1,7 +1,7 @@
import ReleaseTransformations._
val catsVersion = "1.0.0-MF"
val catsEffectVersion = "0.4"
val catsVersion = "1.0.0-RC1"
val catsEffectVersion = "0.5"
val utilVersion = "17.10.0"
val finagleVersion = "17.10.0"
@@ -1,7 +1,6 @@
package io.catbird.finagle
import cats.arrow.Category
import cats.functor.Profunctor
import cats.arrow.{ Category, Profunctor }
import io.catbird.util.twitterFutureInstance
import com.twitter.finagle.Service
@@ -6,5 +6,5 @@ import com.twitter.util.{ Await, Duration }
trait EqInstances {
def serviceEq[I, O](atMost: Duration)(implicit eqF: Eq[I => O]): Eq[Service[I, O]] =
eqF.on(_.andThen(o => Await.result(o, atMost)))
Eq.by[Service[I, O], I => O](_.andThen(o => Await.result(o, atMost)))(eqF)
}
@@ -130,10 +130,10 @@ final object Rerunnable extends RerunnableInstances1 {
}
final def rerunnableEq[A](atMost: Duration)(implicit A: Eq[A]): Eq[Rerunnable[A]] =
futureEq[A](atMost).on(_.run)
Eq.by[Rerunnable[A], Future[A]](_.run)(futureEq[A](atMost))
final def rerunnableEqWithFailure[A](atMost: Duration)(implicit A: Eq[A], T: Eq[Throwable]): Eq[Rerunnable[A]] =
futureEqWithFailure[A](atMost).on(_.run)
Eq.by[Rerunnable[A], Future[A]](_.run)(futureEqWithFailure[A](atMost))
}
private[util] trait RerunnableInstances1 {
@@ -42,7 +42,7 @@ trait FutureInstances extends FutureInstances1 {
}
final def futureEqWithFailure[A](atMost: Duration)(implicit A: Eq[A], T: Eq[Throwable]): Eq[Future[A]] =
futureEq[Try[A]](atMost).on(_.liftToTry)
Eq.by[Future[A], Future[Try[A]]](_.liftToTry)(futureEq[Try[A]](atMost))
}
private[util] trait FutureInstances1 {
@@ -5,7 +5,7 @@ import cats.instances.either._
import cats.instances.int._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.laws.GroupLaws
import cats.kernel.laws.discipline.MonoidTests
import cats.laws.discipline._
import cats.laws.discipline.arbitrary._
import com.twitter.conversions.time._
@@ -20,6 +20,5 @@ class RerunnableSuite extends FunSuite with Discipline with ArbitraryInstances w
checkAll("Rerunnable[Int]", MonadErrorTests[Rerunnable, Throwable].monadError[Int, Int, Int])
checkAll("Rerunnable[Int]", ComonadTests[Rerunnable].comonad[Int, Int, Int])
checkAll("Rerunnable[Int]", FunctorTests[Rerunnable](rerunnableComonad).functor[Int, Int, Int])
checkAll("Rerunnable[Int]", GroupLaws[Rerunnable[Int]].semigroup)
checkAll("Rerunnable[Int]", GroupLaws[Rerunnable[Int]].monoid)
checkAll("Rerunnable[Int]", MonoidTests[Rerunnable[Int]].monoid)
}
@@ -5,7 +5,7 @@ import cats.instances.either._
import cats.instances.int._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.laws.GroupLaws
import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline._
import cats.laws.discipline.arbitrary._
import com.twitter.conversions.time._
@@ -25,6 +25,6 @@ class FutureSuite extends FunSuite with Discipline with FutureInstances with Arb
checkAll("Future[Int]", MonadErrorTests[Future, Throwable].monadError[Int, Int, Int])
checkAll("Future[Int]", ComonadTests[Future].comonad[Int, Int, Int])
checkAll("Future[Int]", FunctorTests[Future](comonad).functor[Int, Int, Int])
checkAll("Future[Int]", GroupLaws[Future[Int]].semigroup(twitterFutureSemigroup[Int]))
checkAll("Future[Int]", GroupLaws[Future[Int]].monoid)
checkAll("Future[Int]", SemigroupTests[Future[Int]](twitterFutureSemigroup[Int]).semigroup)
checkAll("Future[Int]", MonoidTests[Future[Int]].monoid)
}
@@ -5,7 +5,7 @@ import cats.instances.int._
import cats.instances.option._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.laws.GroupLaws
import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline.{ MonadErrorTests, TraverseTests }
import cats.laws.discipline.arbitrary._
import com.twitter.util.{ Return, Throw, Try }
@@ -18,8 +18,8 @@ trait TryTest extends ArbitraryInstances with EqInstances with TryInstances
class TrySuite extends FunSuite with TryTest with Discipline {
checkAll("Try[Int]", MonadErrorTests[Try, Throwable].monadError[Int, Int, Int])
checkAll("Try[Int]", TraverseTests[Try].traverse[Int, Int, Int, Int, Option, Option])
checkAll("Try[Int]", GroupLaws[Try[Int]].semigroup(twitterTrySemigroup[Int]))
checkAll("Try[Int]", GroupLaws[Try[Int]].monoid)
checkAll("Try[Int]", SemigroupTests[Try[Int]](twitterTrySemigroup[Int]).semigroup)
checkAll("Try[Int]", MonoidTests[Try[Int]].monoid)
}
class TrySpec extends PropSpec with PropertyChecks with Checkers with TryTest {
@@ -3,7 +3,7 @@ package io.catbird.util
import cats.{ Comonad, Eq }
import cats.instances.int._
import cats.instances.tuple._
import cats.kernel.laws.GroupLaws
import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline._
import com.twitter.util.Var
import org.scalatest.FunSuite
@@ -18,6 +18,6 @@ class VarSuite extends FunSuite with Discipline with VarInstances with Arbitrary
checkAll("Var[Int]", MonadTests[Var].stackUnsafeMonad[Int, Int, Int])
checkAll("Var[Int]", ComonadTests[Var].comonad[Int, Int, Int])
checkAll("Var[Int]", GroupLaws[Var[Int]].semigroup(twitterVarSemigroup[Int]))
checkAll("Var[Int]", GroupLaws[Var[Int]].monoid)
checkAll("Var[Int]", SemigroupTests[Var[Int]](twitterVarSemigroup[Int]).semigroup)
checkAll("Var[Int]", MonoidTests[Var[Int]].monoid)
}

0 comments on commit a27d926

Please sign in to comment.