Skip to content

Instantly share code, notes, and snippets.

@dam5s
Last active April 29, 2018 23:31
Show Gist options
  • Save dam5s/2cd8caeb1b1f0ace38ca236de7c54cc1 to your computer and use it in GitHub Desktop.
Save dam5s/2cd8caeb1b1f0ace38ca236de7c54cc1 to your computer and use it in GitHub Desktop.
Union types in Kotlin 1.1 using sealed classes and data classes.
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