Skip to content

Instantly share code, notes, and snippets.

@sergiilagutin
Created August 17, 2016 14:55
Show Gist options
  • Select an option

  • Save sergiilagutin/3a07ec7cebeeb62bd56d292d1b5843e5 to your computer and use it in GitHub Desktop.

Select an option

Save sergiilagutin/3a07ec7cebeeb62bd56d292d1b5843e5 to your computer and use it in GitHub Desktop.
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
def future1(): Future[Int] = ???
def future2(): Future[Int] = ???
val z1 = for {
x <- future1()
y <- future2()
} yield x + y
val f1 = future1()
val f2 = future2()
val z2 = for {
x <- f1
y <- f1
} yield x + y
// z1 vs z2 ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment