Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add merge to validated #2739

Merged
merged 5 commits into from Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Expand Up @@ -2398,6 +2398,7 @@ public final class arrow/core/ValidatedKt {
public static final fun invalid (Ljava/lang/Object;)Larrow/core/Validated;
public static final fun invalidNel (Ljava/lang/Object;)Larrow/core/Validated;
public static final fun leftWiden (Larrow/core/Validated;)Larrow/core/Validated;
public static final fun merge (Larrow/core/Validated;)Ljava/lang/Object;
public static final fun orElse (Larrow/core/Validated;Lkotlin/jvm/functions/Function0;)Larrow/core/Validated;
public static final fun orNone (Larrow/core/Validated;)Larrow/core/Option;
public static final fun orNull (Larrow/core/Validated;)Ljava/lang/Object;
Expand Down
Expand Up @@ -812,6 +812,9 @@ public inline fun <E, A, B> Validated<E, A>.redeem(fe: (E) -> B, fa: (A) -> B):
public fun <E, A> Validated<E, A>.attempt(): Validated<Nothing, Either<E, A>> =
map { Right(it) }.handleError { Left(it) }

public inline fun <A> Validated<A, A>.merge(): A =
fold(::identity, ::identity)

public fun <E, A> Validated<E, A>.combine(
SE: Semigroup<E>,
SA: Semigroup<A>,
Expand Down