public class MapKt
| Modifier and Type | Method and Description |
|---|---|
static <V,E,U> Result<U,E> |
flatMap(Result<? extends V,? extends E> $receiver,
kotlin.jvm.functions.Function1<? super V,? extends au.com.dius.pact.com.github.michaelbull.result.Result<? extends U,? extends E>> transform)
Maps this
class Result to class Result by either applying the transform function
if this class Result is class Ok, or returning this class Err. |
static <V,E,U> Result<U,E> |
map(Result<? extends V,? extends E> $receiver,
kotlin.jvm.functions.Function1<? super V,? extends U> transform)
Maps this
class Result to class Result by either applying the transform function
to the value if this class Result is class Ok, or returning this class Err. |
static <V,E,U> U |
mapBoth(Result<? extends V,? extends E> $receiver,
kotlin.jvm.functions.Function1<? super V,? extends U> success,
kotlin.jvm.functions.Function1<? super E,? extends U> failure)
Maps this
class Result to U by applying either the success function if this class Result
is class Ok, or the failure function if this class Result is an class Err. Both of these functions must
return the same type (U). |
static <V,E,U,F> Result<U,F> |
mapEither(Result<? extends V,? extends E> $receiver,
kotlin.jvm.functions.Function1<? super V,? extends U> success,
kotlin.jvm.functions.Function1<? super E,? extends F> failure)
Maps this
class Result to class Result by applying either the success function
if this class Result is class Ok, or the failure function if this class Result is an class Err. |
static <V,E,F> Result<V,F> |
mapError(Result<? extends V,? extends E> $receiver,
kotlin.jvm.functions.Function1<? super E,? extends F> transform)
Maps this
class Result to class Result by either applying the transform function
to the error if this class Result is class Err, or returning this class Ok. |
public static <V,E,U> Result<U,E> map(Result<? extends V,? extends E> $receiver, kotlin.jvm.functions.Function1<? super V,? extends U> transform)
Maps this class Result to class Result by either applying the transform function
to the value if this class Result is class Ok, or returning this class Err.
Elm: Result.map
Haskell: Data.Bifunctor.first
Rust: Result.map
class Result,
class Result,
class Result,
class Ok,
class Err,
Result.map,
Data.Bifunctor.first,
Result.mappublic static <V,E,F> Result<V,F> mapError(Result<? extends V,? extends E> $receiver, kotlin.jvm.functions.Function1<? super E,? extends F> transform)
Maps this class Result to class Result by either applying the transform function
to the error if this class Result is class Err, or returning this class Ok.
public static <V,E,U> U mapBoth(Result<? extends V,? extends E> $receiver, kotlin.jvm.functions.Function1<? super V,? extends U> success, kotlin.jvm.functions.Function1<? super E,? extends U> failure)
Maps this class Result to U by applying either the success function if this class Result
is class Ok, or the failure function if this class Result is an class Err. Both of these functions must
return the same type (U).
Elm: Result.Extra.mapBoth
Haskell: Data.Either.either
public static <V,E,U,F> Result<U,F> mapEither(Result<? extends V,? extends E> $receiver, kotlin.jvm.functions.Function1<? super V,? extends U> success, kotlin.jvm.functions.Function1<? super E,? extends F> failure)
Maps this class Result to class Result by applying either the success function
if this class Result is class Ok, or the failure function if this class Result is an class Err.
Haskell: Data.Bifunctor.Bimap
class Result,
class Result,
class Result,
class Ok,
class Result,
class Err,
Data.Bifunctor.Bimappublic static <V,E,U> Result<U,E> flatMap(Result<? extends V,? extends E> $receiver, kotlin.jvm.functions.Function1<? super V,? extends au.com.dius.pact.com.github.michaelbull.result.Result<? extends U,? extends E>> transform)
Maps this class Result to class Result by either applying the transform function
if this class Result is class Ok, or returning this class Err.
This is functionally equivalent to AndKt.andThen.
Scala: Either.flatMap
class Result,
class Result,
class Result,
class Ok,
class Err,
AndKt.andThen,
Either.flatMap