Core concept

Option(1).flatMap(x => Option(x + 1))  // Some(2)
for { a <- Option(1); b <- Option(2) } yield a + b
Advertisement

How it works

Not all types are monads. Semantic laws.

Advertisement

Trade-offs + gotchas

Compositional error handling, async, collections.