Skip to content

Instantly share code, notes, and snippets.


priort/CreatePianoTrio1.scala Secret

Created Dec 30, 2018
What would you like to do?
def createPianoTrio(pianoPlayerName:String, bassPlayerName:String, drummerName:String): Option[PianoTrio] =
.flatMap(validPianoPlayer => BassPlayer(bassPlayerName)
.flatMap(validBassPlayer => Drummer(drummerName)
.map( validDrummer => PianoTrio(validPianoPlayer, validBassPlayer, validDrummer))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment