Created
August 13, 2021 11:42
-
-
Save Haaroon/f18108c20445f4d02e4e7211f4a841f2 to your computer and use it in GitHub Desktop.
Scala Future coffee code from Neophyte
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
def prepareCappuccino(): Future[Cappuccino] = { | |
val groundCoffee = grind("arabica beans") | |
val heatedWater = heatWater(Water(20)) | |
val frothedMilk = frothMilk("milk") | |
for { | |
ground <- groundCoffee | |
water <- heatedWater | |
foam <- frothedMilk | |
espresso <- brew(ground, water) | |
} yield combine(espresso, foam) | |
} | |
// part 8 https://danielwestheide.com/blog/the-neophytes-guide-to-scala-part-8-welcome-to-the-future/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment