Skip to content

Instantly share code, notes, and snippets.

@alexandru
Created October 31, 2014 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandru/41acda9bdd694bec38b2 to your computer and use it in GitHub Desktop.
Save alexandru/41acda9bdd694bec38b2 to your computer and use it in GitHub Desktop.
sealed trait Option[+T] {
def map[U](f: T => U): Option[U] = this match {
case Some(value) => Some(f(value))
case None => None
}
}
case class Some[+T](value: T) extends Option[T]
case object None extends Option[Nothing]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment