that homebrew `Either` I mentioned: ```sealed clas...
# chicago
e
that homebrew
Either
I mentioned:
Copy code
sealed class Result<Issue, Value> : Serializable {
    val isSuccess: Boolean = when (this) {
        is Success -> true
        is Failure -> false
    }
    val isFailure: Boolean = !isSuccess
    /**
     * Allows one to map across only Success values
     */
    fun <NewValue> map(f: (Value) -> NewValue): Result<Issue, NewValue> =
        flatMap { Success<Issue, NewValue>(f(it)) }
    fun <Issue, Value, NewValue> Result<Issue, Value>.flatMap(f: (Value) -> Result<Issue, NewValue>): Result<Issue, NewValue> =
        when (this) {
            is Success -> f(this.value)
            is Failure -> Failure(this.reason)
        }
    fun <NewIssue> mapLeft(f: (Issue) -> NewIssue): Result<NewIssue, Value> =
        when (this) {
            is Success -> Success(this.value)
            is Failure -> Failure(f(this.reason))
        }
}
data class Success<Issue, Value>(val value: Value) : Result<Issue, Value>()
data class Failure<Issue, Value>(val reason: Issue) : Result<Issue, Value>()
­čĺ» 1