Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. final case class Failure[+T](exception: Throwable) extends Try[T]`
  2.  
  3. final case class Failure(exception: Throwable) extends Try[Nothing]`
  4.  
  5. object None extends Option[Nothing]
  6.  
  7. def zip[U](that: Future[U]): Future[(T, U)] = {
  8. implicit val ec = internalExecutor
  9. val p = Promise[(T, U)]()
  10. onComplete {
  11. case f: Failure[_] => p complete f.asInstanceOf[Failure[(T, U)]]
  12. case Success(s) => that onComplete { c => p.complete(c map { s2 => (s, s2) }) }
  13. }
  14. p.future
  15. }
  16.  
  17. case f: Failure[_] => p complete f.asInstanceOf[Failure[(T, U)]]
  18.  
  19. case f: Failure => p complete f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement