Last active
April 29, 2018 23:31
-
-
Save dam5s/2cd8caeb1b1f0ace38ca236de7c54cc1 to your computer and use it in GitHub Desktop.
Union types in Kotlin 1.1 using sealed classes and data classes.
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 class Maybe<T> { | |
object Nothing: Maybe() | |
data class Some<T>(val value: T): Maybe<T>() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment