Skip to content

Instantly share code, notes, and snippets.

@devth
Last active March 21, 2016 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devth/c126a29dc84f60add0fa to your computer and use it in GitHub Desktop.
Save devth/c126a29dc84f60add0fa to your computer and use it in GitHub Desktop.
object HouseBuilderAsync1 {
def circumference(d: Double): Future[Double] = Math.piSlow.map { _ * d }
def buildWindow(c: Double): Window = Window(c)
def buildHouse(window: Window): House = House(window)
}
object HouseControllerAsync1 {
import HouseBuilderAsync._
circumference(10).map(buildWindow).map(buildHouse)
// scala.concurrent.Future[AsynsVsSync.House] = Success(House(Window(31.400000000000002)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment