Skip to content
Browse files

add map

  • Loading branch information...
1 parent 8e38487 commit 7dfd9d8425d06d96a7ed567906a4f2c2447d0997 Sam Ritchie committed Feb 13, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 algebird-util/src/main/scala/com/twitter/algebird/util/UtilAlgebras.scala
View
6 algebird-util/src/main/scala/com/twitter/algebird/util/UtilAlgebras.scala
@@ -21,11 +21,13 @@ import com.twitter.util.{ Future, Return, Try }
object UtilAlgebras {
implicit val futureMonad: Monad[Future] = new Monad[Future] {
- def apply[T](v: T) = Future.value(v);
+ def apply[T](v: T) = Future.value(v)
+ override def map[T, U](m: Future[T])(fn: T => U) = m.map(fn)
def flatMap[T, U](m: Future[T])(fn: T => Future[U]) = m.flatMap(fn)
}
implicit val tryMonad: Monad[Try] = new Monad[Try] {
- def apply[T](v: T) = Return(v);
+ def apply[T](v: T) = Return(v)
+ override def map[T, U](m: Try[T])(fn: T => U) = m.map(fn)
def flatMap[T,U](m: Try[T])(fn: T => Try[U]) = m.flatMap(fn)
}

0 comments on commit 7dfd9d8

Please sign in to comment.
Something went wrong with that request. Please try again.