Update links to elm-result-extra
This commit is contained in:
parent
b9bf8f1eaf
commit
d7f09ec6d7
@ -71,7 +71,7 @@ inline infix fun <V, E> Result<V, E>.getErrorOr(default: () -> E): E {
|
|||||||
* Returns the [value][Ok.value] if this [Result] is [Ok], otherwise
|
* Returns the [value][Ok.value] if this [Result] is [Ok], otherwise
|
||||||
* the [transformation][transform] of the [error][Err.error].
|
* the [transformation][transform] of the [error][Err.error].
|
||||||
*
|
*
|
||||||
* - Elm: [Result.extract](http://package.elm-lang.org/packages/circuithub/elm-result-extra/1.4.0/Result-Extra#extract)
|
* - Elm: [Result.extract](http://package.elm-lang.org/packages/elm-community/result-extra/2.2.0/Result-Extra#extract)
|
||||||
* - Rust: [Result.unwrap_or_else](https://doc.rust-lang.org/src/core/result.rs.html#735-740)
|
* - Rust: [Result.unwrap_or_else](https://doc.rust-lang.org/src/core/result.rs.html#735-740)
|
||||||
*/
|
*/
|
||||||
inline infix fun <V, E> Result<V, E>.getOrElse(transform: (E) -> V): V {
|
inline infix fun <V, E> Result<V, E>.getOrElse(transform: (E) -> V): V {
|
||||||
|
@ -52,14 +52,14 @@ inline fun <T, R, E> List<T>.foldRight(
|
|||||||
/**
|
/**
|
||||||
* Combines a vararg of [Results][Result] into a single [Result] (holding a [List]).
|
* Combines a vararg of [Results][Result] into a single [Result] (holding a [List]).
|
||||||
*
|
*
|
||||||
* - Elm: [Result.Extra.combine](http://package.elm-lang.org/packages/circuithub/elm-result-extra/1.4.0/Result-Extra#combine)
|
* - Elm: [Result.Extra.combine](http://package.elm-lang.org/packages/elm-community/result-extra/2.2.0/Result-Extra#combine)
|
||||||
*/
|
*/
|
||||||
fun <V, E> combine(vararg results: Result<V, E>) = results.asIterable().combine()
|
fun <V, E> combine(vararg results: Result<V, E>) = results.asIterable().combine()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combines an [Iterable] of [Results][Result] into a single [Result] (holding a [List]).
|
* Combines an [Iterable] of [Results][Result] into a single [Result] (holding a [List]).
|
||||||
*
|
*
|
||||||
* - Elm: [Result.Extra.combine](http://package.elm-lang.org/packages/circuithub/elm-result-extra/1.4.0/Result-Extra#combine)
|
* - Elm: [Result.Extra.combine](http://package.elm-lang.org/packages/elm-community/result-extra/2.2.0/Result-Extra#combine)
|
||||||
*/
|
*/
|
||||||
fun <V, E> Iterable<Result<V, E>>.combine(): Result<List<V>, E> {
|
fun <V, E> Iterable<Result<V, E>>.combine(): Result<List<V>, E> {
|
||||||
return Ok(map {
|
return Ok(map {
|
||||||
|
@ -35,7 +35,7 @@ inline infix fun <V, E, F> Result<V, E>.mapError(transform: (E) -> F): Result<V,
|
|||||||
* is [Ok], or the [failure] function if this [Result] is an [Err]. Both of these functions must
|
* is [Ok], or the [failure] function if this [Result] is an [Err]. Both of these functions must
|
||||||
* return the same type (`U`).
|
* return the same type (`U`).
|
||||||
*
|
*
|
||||||
* - Elm: [Result.Extra.mapBoth](http://package.elm-lang.org/packages/circuithub/elm-result-extra/1.4.0/Result-Extra#mapBoth)
|
* - Elm: [Result.Extra.mapBoth](http://package.elm-lang.org/packages/elm-community/result-extra/2.2.0/Result-Extra#mapBoth)
|
||||||
* - Haskell: [Data.Either.either](https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Either.html#v:either)
|
* - Haskell: [Data.Either.either](https://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Either.html#v:either)
|
||||||
*/
|
*/
|
||||||
inline fun <V, E, U> Result<V, E>.mapBoth(
|
inline fun <V, E, U> Result<V, E>.mapBoth(
|
||||||
@ -48,7 +48,6 @@ inline fun <V, E, U> Result<V, E>.mapBoth(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: better name?
|
|
||||||
/**
|
/**
|
||||||
* Maps this [Result<V, E>][Result] to [Result<U, F>][Result] by applying either the [success] function
|
* Maps this [Result<V, E>][Result] to [Result<U, F>][Result] by applying either the [success] function
|
||||||
* if this [Result] is [Ok], or the [failure] function if this [Result] is an [Err].
|
* if this [Result] is [Ok], or the [failure] function if this [Result] is an [Err].
|
||||||
|
Loading…
Reference in New Issue
Block a user