Skip to content

Commit

Permalink
Add serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
Luka Jacobowitz committed Sep 6, 2017
1 parent db806c5 commit 505475d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/data/NonEmptyVector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/src/test/scala/cats/tests/FoldableTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 505475d

Please sign in to comment.