Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Monix Task for
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
You can’t perform that action at this time.