Last active
September 9, 2020 17:41
-
-
Save KaneCheshire/89610e78dda3cd0f37ade5ceb2b78290 to your computer and use it in GitHub Desktop.
A re-implementation of Kotlin and Swift's Result type in Kotlin
This file contains hidden or 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 Result<out S, out F: Throwable> { | |
data class Success<out S, out F: Throwable>(val value: S) : Result<S, F>() | |
data class Failure<out S, out F: Throwable>(val failure: F) : Result<S, F>() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Accompanying post: https://medium.com/@KaneCheshire/f0a065fa6af1?source=friends_link&sk=82c58b88ad4c85b229aed88062fc57b8