Skip to content

Instantly share code, notes, and snippets.

@d10xa
Created January 21, 2019 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d10xa/e3e3b5dd27854f9abb001193a8ae36a0 to your computer and use it in GitHub Desktop.
Save d10xa/e3e3b5dd27854f9abb001193a8ae36a0 to your computer and use it in GitHub Desktop.
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