Skip to content

Commit

Permalink
add merge to validated (#2739)
Browse files Browse the repository at this point in the history
* merge added to validated

* arrow-core.api updated

* moved outside of Validated

Co-authored-by: Imran Malic Settuba <[email protected]>
  • Loading branch information
agusotto96 and i-walker authored Jun 16, 2022
1 parent 61f2100 commit 39b6446
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 39b6446

Please sign in to comment.