Skip to content

Commit

Permalink
Resolving 2.11 Product with Serializable inference
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon Stewart committed Dec 28, 2018
1 parent db97a61 commit a831bf4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/scala/cats/Foldable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,12 @@ import Foldable.sentinel
* {{{
* scala> import cats.implicits._
* scala> val list = List(1,2,3,4)
* scala> Foldable[List].partitionEitherM(list)(a => if (a % 2 == 0) Eval.now(Left(a.toString)) else Eval.now(Right(a))).value
* scala> val partitioned1 = Foldable[List].partitionEitherM(list)(a => if (a % 2 == 0) Eval.now(Either.left[String, Int](a.toString)) else Eval.now(Either.right[String, Int](a)))
* Since `Eval.now` yields a lazy computation, we need to force it to inspect the result:
* scala> partitioned1.value
* res0: (List[String], List[Int]) = (List(2, 4),List(1, 3))
* scala> Foldable[List].partitionEitherM(list)(a => Eval.later(Either.right(a * 4))).value
* scala> val partitioned2 = Foldable[List].partitionEitherM(list)(a => Eval.later(Either.right(a * 4)))
* scala> partitioned2.value
* res1: (List[Nothing], List[Int]) = (List(),List(4, 8, 12, 16))
* }}}
*/
Expand Down

0 comments on commit a831bf4

Please sign in to comment.