Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cats.data.EitherNel
- import cats.data.NonEmptyList
- import cats.implicits._
- object SeqEitherNel {
- def main(args: Array[String]): Unit = {
- def data =
- (1 to 5).map {
- case i if i % 2 == 0 => Right(i)
- case i => Left(NonEmptyList.one(i.toString))
- }.toList
- val eithers: List[Either[NonEmptyList[String], Int]] = data
- // val eithers: List[EitherNel[String, Int]] = data // could not find implicit value for parameter G: cats.Bifoldable[cats.data.EitherNel]
- val a: (List[NonEmptyList[String]], List[Int]) =
- eithers.separate
- println(a)
- }
- }
Add Comment
Please, Sign In to add comment