Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scalaz.std.option._
- import scalaz.syntax.std.option._
- // the standard scala way:
- for {
- a <- Some(12)
- b <- None: Option[Int]
- } yield a + b
- // None is of type Option[Nothing] by default,
- // so in order to force it to type-check I have to write None: Option[Int]
- // the scalaz way:
- for {
- a <- 12.some
- b <- none[Int]
- } yield a + b
- // same goes for none in scalaz,
- // but it has none[Int] for convenience
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement