//arrow-core/arrow.core/Validated
common sealed class Validated<out E, out A>
Name | Summary |
---|---|
Companion | common object Companion |
Invalid | common data class Invalid<out E>(val value: E) : Validated<E, Nothing> |
Valid | common data class Valid<out A>(val value: A) : Validated<Nothing, A> |
Name | Summary |
---|---|
all | common inline fun all(predicate: (A) -> Boolean): Boolean |
bifoldLeft | common inline fun <B> bifoldLeft(c: B, fe: (B, E) -> B, fa: (B, A) -> B): B |
bifoldMap | common inline fun <B> bifoldMap(MN: Monoid<B>, g: (E) -> B, f: (A) -> B): B |
bimap | common inline fun <EE, B> bimap(fe: (E) -> EE, fa: (A) -> B): Validated<EE, B> From arrow.typeclasses.Bifunctor, maps both types of this Validated. |
bitraverse | common inline fun <EE, B> bitraverse(fe: (E) -> Iterable<EE>, fa: (A) -> Iterable<B>): List<Validated<EE, B» |
bitraverseEither | common inline fun <EE, B, C> bitraverseEither(fe: (E) -> Either<EE, B>, fa: (A) -> Either<EE, C>): Either<EE, Validated<B, C» |
bitraverseNullable | common inline fun <B, C> bitraverseNullable(fe: (E) -> B?, fa: (A) -> C?): Validated<B, C>? |
bitraverseOption | common inline fun <B, C> bitraverseOption(fe: (E) -> Option<B>, fa: (A) -> Option<C>): Option<Validated<B, C» |
exist | common inline fun exist(predicate: (A) -> Boolean): Boolean Is this Valid and matching the given predicate |
findOrNull | common inline fun findOrNull(predicate: (A) -> Boolean): A? |
fold | common inline fun <B> fold(fe: (E) -> B, fa: (A) -> B): B |
foldLeft | common inline fun <B> foldLeft(b: B, f: (B, A) -> B): B apply the given function to the value with the given B when valid, otherwise return the given B |
foldMap | common inline fun <B> foldMap(MB: Monoid<B>, f: (A) -> B): B |
isEmpty | common fun isEmpty(): Boolean |
isNotEmpty | common fun isNotEmpty(): Boolean |
map | common inline fun <B> map(f: (A) -> B): Validated<E, B> Apply a function to a Valid value, returning a new Valid value |
mapLeft | common inline fun <EE> mapLeft(f: (E) -> EE): Validated<EE, A> Apply a function to an Invalid value, returning a new Invalid value. Or, if the original valid was Valid, return it. |
swap | common fun swap(): Validated<A, E> |
tap | common inline fun tap(f: (A) -> Unit): Validated<E, A> The given function is applied as a fire and forget effect if this is Valid . When applied the result is ignored and the original Validated value is returned |
tapInvalid | common inline fun tapInvalid(f: (E) -> Unit): Validated<E, A> The given function is applied as a fire and forget effect if this is Invalid . When applied the result is ignored and the original Validated value is returned |
toEither | common fun toEither(): Either<E, A> Converts the value to an Either |
toList | common fun toList(): List<A> Convert this value to a single element List if it is Valid, otherwise return an empty List |
toOption | common fun toOption(): Option<A> Returns Valid values wrapped in Some, and None for Invalid values |
toString | common open override fun toString(): String |
toValidatedNel | common fun toValidatedNel(): ValidatedNel<E, A> Lift the Invalid value into a NonEmptyList. |
traverse | common inline fun <B> traverse(fa: (A) -> Iterable<B>): List<Validated<E, B» |
traverseEither | common inline fun <EE, B> traverseEither(fa: (A) -> Either<EE, B>): Either<EE, Validated<E, B» |
traverseNullable | common inline fun <B> traverseNullable(fa: (A) -> B?): Validated<E, B>? |
traverseOption | common inline fun <B> traverseOption(fa: (A) -> Option<B>): Option<Validated<E, B» |
void | common fun void(): Validated<E, Unit> Discards the A value inside Validated signaling this container may be pointing to a noop or an effect whose return value is deliberately ignored. The singleton value Unit serves as signal. |
withEither | common inline fun <EE, B> withEither(f: (Either<E, A>) -> Either<EE, B>): Validated<EE, B> Convert to an Either, apply a function, convert back. This is handy when you want to use the Monadic properties of the Either type. |
Name | Summary |
---|---|
isInvalid | common val isInvalid: Boolean |
isValid | common val isValid: Boolean |
Name |
---|
Valid |
Invalid |
Name | Summary |
---|---|
andThen | common inline fun <E, A, B> Validated<E, A>.andThen(f: (A) -> Validated<E, B>): Validated<E, B> Apply a function to a Valid value, returning a new Validation that may be valid or invalid |
attempt | common fun <E, A> Validated<E, A>.attempt(): Validated<Nothing, Either<E, A» |
bind | common |
bisequence | common fun <E, A> Validated<Iterable<E>, Iterable<A».bisequence(): List<Validated<E, A» |
bisequenceEither | common fun <E, A, B> Validated<Either<E, A>, Either<E, B».bisequenceEither(): Either<E, Validated<A, B» |
bisequenceNullable | common fun <A, B> Validated<A?, B?>.bisequenceNullable(): Validated<A, B>? |
bisequenceOption | common fun <A, B> Validated<Option<A>, Option<B».bisequenceOption(): Option<Validated<A, B» |
combine | common fun <E, A> Validated<E, A>.combine(SE: Semigroup<E>, SA: Semigroup<A>, y: Validated<E, A>): Validated<E, A> |
combineAll | common |
combineK | common fun <E, A> Validated<E, A>.combineK(SE: Semigroup<E>, y: Validated<E, A>): Validated<E, A> |
compareTo | common operator fun <E : Comparable<E>, A : Comparable<A» Validated<E, A>.compareTo(other: Validated<E, A>): Int |
findValid | common inline fun <E, A> Validated<E, A>.findValid(SE: Semigroup<E>, that: () -> Validated<E, A>): Validated<E, A> If this is valid return this , otherwise if that is valid return that , otherwise combine the failures. This is similar to orElse except that here failures are accumulated. |
fold | common fun <E, A> Validated<E, A>.fold(MA: Monoid<A>): A |
getOrElse | common inline fun <E, A> Validated<E, A>.getOrElse(default: () -> A): A Return the Valid value, or the default if Invalid |
handleError | common inline fun <E, A> Validated<E, A>.handleError(f: (E) -> A): Validated<Nothing, A> |
handleErrorWith | common inline fun <E, A> Validated<E, A>.handleErrorWith(f: (E) -> Validated<E, A>): Validated<E, A> |
leftWiden | common fun <EE, E : EE, A> Validated<E, A>.leftWiden(): Validated<EE, A> |
orElse | common inline fun <E, A> Validated<E, A>.orElse(default: () -> Validated<E, A>): Validated<E, A> Return this if it is Valid, or else fall back to the given default. The functionality is similar to that of findValid except for failure accumulation, where here only the error on the right is preserved and the error on the left is ignored. |
orNone | common fun <E, A> Validated<E, A>.orNone(): Option<A> |
orNull | common fun <E, A> Validated<E, A>.orNull(): A? Return the Valid value, or null if Invalid |
redeem | common inline fun <E, A, B> Validated<E, A>.redeem(fe: (E) -> B, fa: (A) -> B): Validated<E, B> |
replicate | common fun <E, A> Validated<E, A>.replicate(SE: Semigroup<E>, n: Int): Validated<E, List<A» fun <E, A> Validated<E, A>.replicate(SE: Semigroup<E>, n: Int, MA: Monoid<A>): Validated<E, A> |
sequence | common fun <E, A> Validated<E, Iterable<A».sequence(): List<Validated<E, A» |
sequenceEither | common fun <E, A, B> Validated<A, Either<E, B».sequenceEither(): Either<E, Validated<A, B» |
sequenceNullable | common fun <A, B> Validated<A, B?>.sequenceNullable(): Validated<A, B>? |
sequenceOption | common fun <A, B> Validated<A, Option<B».sequenceOption(): Option<Validated<A, B» |
toIor | common fun <E, A> Validated<E, A>.toIor(): Ior<E, A> Converts the value to an Ior |
valueOr | common inline fun <E, A> Validated<E, A>.valueOr(f: (E) -> A): A Return the Valid value, or the result of f if Invalid |
widen | common fun <E, B, A : B> Validated<E, A>.widen(): Validated<E, B> Given A is a sub type of B, re-type this value from Validated to Validated |
zip | common fun <E, A, B> Validated<E, A>.zip(SE: Semigroup<E>, fb: Validated<E, B>): Validated<E, Pair<A, B» inline fun <E, A, B, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, f: (A, B) -> Z): Validated<E, Z> inline fun <E, A, B, C, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, f: (A, B, C) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, f: (A, B, C, D) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, EE, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, e: Validated<E, EE>, f: (A, B, C, D, EE) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, EE, FF, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, e: Validated<E, EE>, ff: Validated<E, FF>, f: (A, B, C, D, EE, FF) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, EE, F, G, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, e: Validated<E, EE>, ff: Validated<E, F>, g: Validated<E, G>, f: (A, B, C, D, EE, F, G) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, EE, F, G, H, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, e: Validated<E, EE>, ff: Validated<E, F>, g: Validated<E, G>, h: Validated<E, H>, f: (A, B, C, D, EE, F, G, H) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, EE, F, G, H, I, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, e: Validated<E, EE>, ff: Validated<E, F>, g: Validated<E, G>, h: Validated<E, H>, i: Validated<E, I>, f: (A, B, C, D, EE, F, G, H, I) -> Z): Validated<E, Z> inline fun <E, A, B, C, D, EE, F, G, H, I, J, Z> Validated<E, A>.zip(SE: Semigroup<E>, b: Validated<E, B>, c: Validated<E, C>, d: Validated<E, D>, e: Validated<E, EE>, ff: Validated<E, F>, g: Validated<E, G>, h: Validated<E, H>, i: Validated<E, I>, j: Validated<E, J>, f: (A, B, C, D, EE, F, G, H, I, J) -> Z): Validated<E, Z> |
Do you like Arrow?
✖