Last active
October 17, 2017 13:22
-
-
Save StephanSchmidt/a53c8897db133b52efda7172d84751e3 to your computer and use it in GitHub Desktop.
Monix Task for
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 task1 = Task.fork(Task { Thread.sleep(2000); println("Runnung 1"); 1 + 1 }) | |
val task2 = Task.fork(Task { println("Runnung 2"); 1 + 1 }) | |
println("a") | |
val t:Task[Int] = for ( | |
r1 <- task1; | |
r2 <- task2 | |
) yield r1 + r2 | |
println("b") | |
--- Or | |
val t:Task[Int] = for ( | |
r <- Task.mapBoth(task1,task2)(_ + _) | |
) yield r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment