Skip to content

Instantly share code, notes, and snippets.

@durre
Created November 16, 2015 20:10
Show Gist options
  • Save durre/67fd5010ab840e3c0598 to your computer and use it in GitHub Desktop.
Save durre/67fd5010ab840e3c0598 to your computer and use it in GitHub Desktop.
object FutureUtils {
def sequenceOr[T](result: Or[Future[T], ErrorMessage]): Future[Or[T, ErrorMessage]] = {
result match {
case Good(futureValue) => futureValue.map(Good(_))
case Bad(msg) => Future.successful(Bad(msg))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment