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 3 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 @@ -2319,6 +2319,7 @@ public abstract class arrow/core/Validated {
public static final fun lift (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
public final fun map (Lkotlin/jvm/functions/Function1;)Larrow/core/Validated;
public final fun mapLeft (Lkotlin/jvm/functions/Function1;)Larrow/core/Validated;
public final fun merge (Larrow/core/Validated;)Ljava/lang/Object;
public final fun swap ()Larrow/core/Validated;
public final fun tap (Lkotlin/jvm/functions/Function1;)Larrow/core/Validated;
public final fun tapInvalid (Lkotlin/jvm/functions/Function1;)Larrow/core/Validated;
Expand Down
Expand Up @@ -214,6 +214,9 @@ public sealed class Validated<out E, out A> {
is Invalid -> (fe(value))
}

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

public val isValid: Boolean =
fold({ false }, { true })
public val isInvalid: Boolean =
Expand Down