Created
November 28, 2018 17:26
-
-
Save darkfrog26/f28a8f8d56cce8345aa8ef7f069fe8fc 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 MyOption[+A] extends Any { | |
def isEmpty: Boolean | |
def isDefined: Boolean | |
} | |
class MySome[+A](val value: A) extends AnyVal with MyOption[A] { | |
def isEmpty: Boolean = false | |
def isDefined: Boolean = true | |
} | |
object MyNone extends MyOption[Nothing] { | |
def isEmpty: Boolean = true | |
def isDefined: Boolean = false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment