Skip to content

Instantly share code, notes, and snippets.

@yoshiyoshifujii
Created March 10, 2017 06:30
Show Gist options
  • Save yoshiyoshifujii/3eb7d058c10fd022bf4dd7ef2a317622 to your computer and use it in GitHub Desktop.
Save yoshiyoshifujii/3eb7d058c10fd022bf4dd7ef2a317622 to your computer and use it in GitHub Desktop.
def splitEither[A,B](el: Seq[Either[A,B]]): (Seq[A], Seq[B]) = {
val (lefts, rights) = el.partition(_.isLeft)
(lefts.map(_.left.get), rights.map(_.right.get))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment