# Invalid

data class Invalid<out E>(val value: E) : Validated<E, Nothing> (source)

## Constructors

fun <out E> Invalid(value: E)

## Functions

inline fun all(predicate: (Nothing) -> Boolean): Boolean
inline fun <B> bifoldLeft(c: B, fe: (B, E) -> B, fa: (B, Nothing) -> B): B
inline fun <B> bifoldMap(MN: Monoid<B>, g: (E) -> B, f: (Nothing) -> B): B
inline fun <EE, B> bimap(fe: (E) -> EE, fa: (Nothing) -> B): Validated<EE, B>

From arrow.typeclasses.Bifunctor, maps both types of this Validated.

inline fun <EE, B> bitraverse(fe: (E) -> Iterable<EE>, fa: (Nothing) -> Iterable<B>): List<Validated<EE, B>>
inline fun <EE, B, C> bitraverseEither(fe: (E) -> Either<EE, B>, fa: (Nothing) -> Either<EE, C>): Either<EE, Validated<B, C>>
inline fun <B, C> bitraverseNullable(fe: (E) -> B?, fa: (Nothing) -> C?): Validated<B, C>?
inline fun <B, C> bitraverseOption(fe: (E) -> Option<B>, fa: (Nothing) -> Option<C>): Option<Validated<B, C>>
inline fun exist(predicate: (Nothing) -> Boolean): Boolean

Is this Valid and matching the given predicate

inline fun findOrNull(predicate: (Nothing) -> Boolean): Nothing?
inline fun <B> fold(fe: (E) -> B, fa: (Nothing) -> B): B
inline fun <B> foldLeft(b: B, f: (B, Nothing) -> B): B

apply the given function to the value with the given B when valid, otherwise return the given B

inline fun <B> foldMap(MB: Monoid<B>, f: (Nothing) -> B): B
inline fun <B> map(f: (Nothing) -> B): Validated<E, B>

Apply a function to a Valid value, returning a new Valid value

inline fun <EE> mapLeft(f: (E) -> EE): Validated<EE, Nothing>

Apply a function to an Invalid value, returning a new Invalid value. Or, if the original valid was Valid, return it.

inline fun tap(f: (Nothing) -> Unit): Validated<E, Nothing>

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

inline fun tapInvalid(f: (E) -> Unit): Validated<E, Nothing>

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

Converts the value to an Either

Convert this value to a single element List if it is Valid, otherwise return an empty List

Returns Valid values wrapped in Some, and None for Invalid values

open override fun toString(): String

Lift the Invalid value into a NonEmptyList.

inline fun <EE, B> traverse(fa: (Nothing) -> Either<EE, B>): Either<EE, Validated<E, B>>
inline fun <B> traverse(fa: (Nothing) -> Option<B>): Option<Validated<E, B>>
inline fun <B> traverse(fa: (Nothing) -> Iterable<B>): List<Validated<E, B>>
inline fun <B> traverseNullable(fa: (Nothing) -> B?): Validated<E, B>?
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.

inline fun <EE, B> withEither(f: (Either<E, Nothing>) -> 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.

val value: E

## Extensions

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

fun <E, A> Validated<E, A>.combine(SE: Semigroup<E>, SA: Semigroup<A>, y: Validated<E, A>): Validated<E, A>
fun <E, A> Validated<E, A>.combineK(SE: Semigroup<E>, y: Validated<E, A>): Validated<E, A>
operator fun <E : Comparable<E>, A : Comparable<A>> Validated<E, A>.compareTo(other: Validated<E, A>): Int
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.

fun <E, A> Validated<E, A>.fold(MA: Monoid<A>): A
inline fun <E, A> Validated<E, A>.getOrElse(default: () -> A): A

Return the Valid value, or the default if Invalid

inline fun <E, A> Validated<E, A>.handleError(f: (E) -> A): Validated<Nothing, A>
inline fun <E, A> Validated<E, A>.handleErrorWith(f: (E) -> Validated<E, A>): Validated<E, A>
fun <EE, E : EE, A> Validated<E, A>.leftWiden(): Validated<EE, A>
inline fun <A> Validated<A, A>.merge(): A
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.

fun <E, A> Validated<E, A>.orNone(): Option<A>
fun <E, A> Validated<E, A>.orNull(): A?

Return the Valid value, or null if Invalid

inline fun <E, A, B> Validated<E, A>.redeem(fe: (E) -> B, fa: (A) -> B): Validated<E, B>
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>
fun <E, A> Validated<E, A>.toIor(): Ior<E, A>

Converts the value to an Ior

inline fun <E, A> Validated<E, A>.valueOr(f: (E) -> A): A

Return the Valid value, or the result of f if Invalid

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

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>
inline fun <E, A, B, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, f: (A, B) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, f: (A, B, C) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, f: (A, B, C, D) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, EE, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, e: ValidatedNel<E, EE>, f: (A, B, C, D, EE) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, EE, FF, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, e: ValidatedNel<E, EE>, ff: ValidatedNel<E, FF>, f: (A, B, C, D, EE, FF) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, EE, F, G, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, e: ValidatedNel<E, EE>, ff: ValidatedNel<E, F>, g: ValidatedNel<E, G>, f: (A, B, C, D, EE, F, G) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, EE, F, G, H, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, e: ValidatedNel<E, EE>, ff: ValidatedNel<E, F>, g: ValidatedNel<E, G>, h: ValidatedNel<E, H>, f: (A, B, C, D, EE, F, G, H) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, EE, F, G, H, I, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, e: ValidatedNel<E, EE>, ff: ValidatedNel<E, F>, g: ValidatedNel<E, G>, h: ValidatedNel<E, H>, i: ValidatedNel<E, I>, f: (A, B, C, D, EE, F, G, H, I) -> Z): ValidatedNel<E, Z>
inline fun <E, A, B, C, D, EE, F, G, H, I, J, Z> ValidatedNel<E, A>.zip(b: ValidatedNel<E, B>, c: ValidatedNel<E, C>, d: ValidatedNel<E, D>, e: ValidatedNel<E, EE>, ff: ValidatedNel<E, F>, g: ValidatedNel<E, G>, h: ValidatedNel<E, H>, i: ValidatedNel<E, I>, j: ValidatedNel<E, J>, f: (A, B, C, D, EE, F, G, H, I, J) -> Z): ValidatedNel<E, Z>