Created
June 23, 2016 11:17
-
-
Save anonymous/5d938f6412cbb5d8a46d6394e272438b to your computer and use it in GitHub Desktop.
the description for this gist
This file contains 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
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