Guest User

Untitled

a guest
Jan 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import cats.data.EitherNel
  2. import cats.data.NonEmptyList
  3. import cats.implicits._
  4.  
  5. object SeqEitherNel {
  6.  
  7. def main(args: Array[String]): Unit = {
  8.  
  9. def data =
  10. (1 to 5).map {
  11. case i if i % 2 == 0 => Right(i)
  12. case i => Left(NonEmptyList.one(i.toString))
  13. }.toList
  14. val eithers: List[Either[NonEmptyList[String], Int]] = data
  15. // val eithers: List[EitherNel[String, Int]] = data // could not find implicit value for parameter G: cats.Bifoldable[cats.data.EitherNel]
  16. val a: (List[NonEmptyList[String]], List[Int]) =
  17. eithers.separate
  18.  
  19. println(a)
  20. }
  21.  
  22. }
Add Comment
Please, Sign In to add comment