Skip to content

Instantly share code, notes, and snippets.

View cameronhotchkies's full-sized avatar

Cameron Hotchkies cameronhotchkies

View GitHub Profile
@cameronhotchkies
cameronhotchkies / HappySequence.scala
Created June 19, 2015 18:02
Like Future.sequence but discards all Future.failure results
def happySequence[A](source: Seq[Future[A]]) = {
val optioned = source.map { f =>
f.map(Option.apply).recover {
case _ => None
}
}
Future.sequence(optioned).map(_.flatten)