max.cruz
01/20/2020, 6:16 PMpublic inline fun <R, T> Result<T>.fold(
onSuccess: (value: T) -> R,
onFailure: (exception: Throwable) -> R
): R
ilya.gorbunov
01/20/2020, 10:55 PMResult
"success" and "failure" rather than "right" and "left" — to avoid the unnatural order they impose on the fold
method parameters.Ky Leggiero
01/21/2020, 2:00 AMJoffrey
01/23/2020, 11:26 AMtry {
// doing successful code
} catch {
// handling failure
}
To:
result.fold({
// doing successful code
}, {
// handling failure
})
Seems pretty convenient to me.max.cruz
01/26/2020, 6:41 PM