
Untitled
By: a guest on
Apr 27th, 2012 | syntax:
None | size: 0.42 KB | hits: 12 | expires: Never
/*
* Functor instance for Future to accumulate transformations
* to be called only when Future#get is invoked.
*/
implicit def FutureFunctor = new Functor[Future] {
def fmap[A, B](r: Future[A], f: A => B) = new Future[B] {
def cancel(miir: Boolean) = r.cancel(miir)
def isCancelled() = r.isCancelled()
def isDone() = r.isDone()
def get() = f(r.get())
def get(ti: Long, tu: TimeUnit) = f(r.get(ti, tu))
}
}