mirror of
https://github.com/corda/corda.git
synced 2025-03-11 06:54:04 +00:00
core: Fix ErrorOr.combine
This commit is contained in:
parent
9d7bfe4229
commit
cae9b758ff
@ -317,7 +317,7 @@ data class ErrorOr<out A> private constructor(val value: A?, val error: Throwabl
|
|||||||
// Applicative
|
// Applicative
|
||||||
fun <B, C> combine(other: ErrorOr<B>, function: (A, B) -> C): ErrorOr<C> {
|
fun <B, C> combine(other: ErrorOr<B>, function: (A, B) -> C): ErrorOr<C> {
|
||||||
val newError = error ?: other.error
|
val newError = error ?: other.error
|
||||||
return ErrorOr(if (newError == null) null else function(value as A, other.value as B), newError)
|
return ErrorOr(if (newError != null) null else function(value as A, other.value as B), newError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Monad
|
// Monad
|
||||||
|
Loading…
x
Reference in New Issue
Block a user