Last active
December 18, 2015 04:18
-
-
Save maowug/88124aeed2eb66af48d4 to your computer and use it in GitHub Desktop.
fseq doesnt wrap it
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
Future.sequence( | |
Option.empty[Seq[Int]].getOrElse(throw new RuntimeException("mA")).map(Future.apply(_)) | |
) recover { | |
case e: Throwable => throw new RuntimeException("mB") | |
} | |
// // Exiting paste mode, now interpreting. | |
// java.lang.RuntimeException: mA | |
// at $anonfun$2.apply(<console>:14) | |
// at $anonfun$2.apply(<console>:14) | |
// at scala.Option.getOrElse(Option.scala:121) | |
// ... 37 elided | |
// def sequence[A, M[X] <: TraversableOnce[X]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = { | |
// in.foldLeft(successful(cbf(in))) { | |
// (fr, fa) => for (r <- fr; a <- fa) yield (r += a) | |
// } map (_.result()) | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment