Skip to content

Instantly share code, notes, and snippets.

Created June 23, 2016 11:17
Show Gist options
  • Save anonymous/5d938f6412cbb5d8a46d6394e272438b to your computer and use it in GitHub Desktop.
Save anonymous/5d938f6412cbb5d8a46d6394e272438b to your computer and use it in GitHub Desktop.
the description for this gist
val ifF: Future[Int] = Future { Thread.sleep(100); 1 }
import com.thoughtworks.each.Monadic._
import scalaz.std.scalaFuture._
val conditional = monadic[Future] {
if(ifF.each == 1) "is one" else "is something else"
}
conditional.onSuccess { case s => println(s"Example 2: $s") }
// prints 'is one' after less than a second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment