Created
January 21, 2019 14:26
-
-
Save d10xa/e3e3b5dd27854f9abb001193a8ae36a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment