From 505475dc8a9d8ef21e18e6bfa277664a60732642 Mon Sep 17 00:00:00 2001 From: Luka Jacobowitz Date: Tue, 5 Sep 2017 22:58:24 +0200 Subject: [PATCH] Add serializable --- core/src/main/scala/cats/data/NonEmptyVector.scala | 6 +++--- tests/src/test/scala/cats/tests/FoldableTests.scala | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/scala/cats/data/NonEmptyVector.scala b/core/src/main/scala/cats/data/NonEmptyVector.scala index 2d72f0393b3..0109cbfeffe 100644 --- a/core/src/main/scala/cats/data/NonEmptyVector.scala +++ b/core/src/main/scala/cats/data/NonEmptyVector.scala @@ -244,10 +244,10 @@ private[data] sealed trait NonEmptyVectorInstances { fa.foldRight(lb)(f) override def nonEmptyPartition[A, B, C](fa: NonEmptyVector[A])(f: (A) => Either[B, C]): Ior[NonEmptyList[B], NonEmptyList[C]] = { - import cats.syntax.reducible._ import cats.syntax.either._ + import cats.syntax.reducible._ - fa.reduceLeftTo(a => f(a).bimap(NonEmptyVector.one, NonEmptyVector.one).toIor)((ior, a) => (f(a), ior) match { + reduceLeftTo(fa)(a => f(a).bimap(NonEmptyVector.one, NonEmptyVector.one).toIor)((ior, a) => (f(a), ior) match { case (Right(c), Ior.Left(_)) => ior.putRight(NonEmptyVector.one(c)) case (Right(c), _) => ior.map(_ :+ c) case (Left(b), Ior.Right(_)) => ior.putLeft(NonEmptyVector.one(b)) @@ -305,7 +305,7 @@ private[data] sealed trait NonEmptyVectorInstances { } -object NonEmptyVector extends NonEmptyVectorInstances { +object NonEmptyVector extends NonEmptyVectorInstances with Serializable { def apply[A](head: A, tail: Vector[A]): NonEmptyVector[A] = new NonEmptyVector(head +: tail) diff --git a/tests/src/test/scala/cats/tests/FoldableTests.scala b/tests/src/test/scala/cats/tests/FoldableTests.scala index 3bf114fe133..4d399f6b8aa 100644 --- a/tests/src/test/scala/cats/tests/FoldableTests.scala +++ b/tests/src/test/scala/cats/tests/FoldableTests.scala @@ -27,8 +27,8 @@ abstract class FoldableCheck[F[_]: Foldable](name: String)(implicit ArbFInt: Arb test("Foldable#partitionEither retains size") { forAll { (fi: F[Int], f: Int => Either[String, String]) => - val list = Foldable[F].toList(fi) - val (lefts, rights) = Foldable[List].partitionEither(list)(f) + val vector = Foldable[F].toList(fi).toVector + val (lefts, rights) = Foldable[Vector].partitionEither(vector)(f) (lefts <+> rights).size.toLong should === (fi.size) } }