Created
May 29, 2020 07:30
-
-
Save vigneshwaranr/f6d6d064b94a24a03afc39c1d723a7a3 to your computer and use it in GitHub Desktop.
9e8a12f2112b / MaybeDivideable / divide2
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
def divide2(a: Int, b: Int): MaybeDivideable = { | |
val aMayBe = MaybeDivideable(a) | |
val bMayBe = MaybeDivideable(b) | |
aMayBe.flatMap { x => | |
bMayBe.flatMap { y => | |
MaybeDivideable(x / y) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment