Created
February 14, 2021 07:41
-
-
Save vigneshwaranr/031a890f78d3a925e78f4581e33c7430 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.Future | |
trait WaterSupply { | |
def turnOn(): Future[Unit] | |
} | |
trait PowerPlant { | |
def waterSupply: WaterSupply | |
def increaseVolumeControl(): Future[Boolean] | |
def turnOn(): Future[Boolean] = { | |
waterSupply.turnOn().flatMap { _ => | |
increaseVolumeControl() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment