-
-
Save alexandru/41acda9bdd694bec38b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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