Skip to content

Instantly share code, notes, and snippets.

View eugener's full-sized avatar

Eugene Ryzhikov eugener

View GitHub Profile
@eugener
eugener / OptionCheatsheet.scala
Created December 3, 2012 03:00 — forked from devnulled/OptionCheatsheet.scala
Scala Option Cheatsheet
// flatMap
// This code is equivalent to:
// option.flatMap(foo(_))
option match {
case None => None
case Some(x) => foo(x)
}
// flatten
// This code is equivalent to: