Skip to content

Instantly share code, notes, and snippets.

@priort

priort/CreatePianoTrio1.scala Secret

Created Dec 30, 2018
Embed
What would you like to do?
def createPianoTrio(pianoPlayerName:String, bassPlayerName:String, drummerName:String): Option[PianoTrio] =
PianoPlayer(pianoPlayerName)
.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
You can’t perform that action at this time.