-
-
Save alexandru/2604948978c497adc8e2 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] | |
} | |
case class Some[+T](value: T) extends Option[T] { | |
def map[U](f: T => U) = Some(f(value)) | |
} | |
case object None extends Option[Nothing] { | |
def map[U](f: T => U) = None | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment