Skip to content

Instantly share code, notes, and snippets.

@vigneshwaranr
Created May 29, 2020 07:30
Show Gist options
  • Save vigneshwaranr/f6d6d064b94a24a03afc39c1d723a7a3 to your computer and use it in GitHub Desktop.
Save vigneshwaranr/f6d6d064b94a24a03afc39c1d723a7a3 to your computer and use it in GitHub Desktop.
9e8a12f2112b / MaybeDivideable / divide2
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