public class Validation<E,T>
extends java.lang.Object
implements java.lang.Iterable<T>
Modifier and Type | Class and Description |
---|---|
static class |
Validation.FailProjection<E,T>
A failing projection of a validation.
|
Modifier and Type | Field and Description |
---|---|
static F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Byte>> |
parseByte
A function that parses a string into a byte.
|
static F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Double>> |
parseDouble
A function that parses a string into a double.
|
static F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Float>> |
parseFloat
A function that parses a string into a float.
|
static F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Integer>> |
parseInt
A function that parses a string into an integer.
|
static F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Long>> |
parseLong
A function that parses a string into a long.
|
static F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Short>> |
parseShort
A function that parses a string into a short.
|
Modifier | Constructor and Description |
---|---|
protected |
Validation(Either<E,T> e) |
Modifier and Type | Method and Description |
---|---|
<A> Validation<E,A> |
accumapply(Semigroup<E> s,
Validation<E,F<T,A>> v)
Function application on the successful side of this validation, or accumulating the errors on the failing side
using the given semigroup should one or more be encountered.
|
Validation<List<E>,T> |
accumulate() |
<B> Validation<List<E>,B> |
accumulate(F<T,B> f) |
<A> Option<E> |
accumulate(Semigroup<E> s,
Validation<E,A> va)
Accumulates errors anonymously.
|
<A,B> Validation<E,B> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
F<T,F<A,B>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B> Validation<E,B> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
F2<T,A,B> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B> Option<E> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb)
Accumulates errors anonymously.
|
<A,B,C> Validation<E,C> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
F<T,F<A,F<B,C>>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C> Validation<E,C> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
F3<T,A,B,C> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C> Option<E> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc)
Accumulates errors anonymously.
|
<A,B,C,D> Validation<E,D> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
F<T,F<A,F<B,F<C,D>>>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D> Validation<E,D> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
F4<T,A,B,C,D> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D> Option<E> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd)
Accumulates errors anonymously.
|
<A,B,C,D,E$> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
F<T,F<A,F<B,F<C,F<D,E$>>>>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
F5<T,A,B,C,D,E$> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve)
Accumulates errors anonymously.
|
<A,B,C,D,E$,F$> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
F<T,F<A,F<B,F<C,F<D,F<E$,F$>>>>>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$,F$> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
F6<T,A,B,C,D,E$,F$> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$,F$> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
Validation<E,F$> vf)
Accumulates errors anonymously.
|
<A,B,C,D,E$,F$,G> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
Validation<E,F$> vf,
F<T,F<A,F<B,F<C,F<D,F<E$,F<F$,G>>>>>>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$,F$,G> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
Validation<E,F$> vf,
F7<T,A,B,C,D,E$,F$,G> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$,F$,G> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
Validation<E,F$> vf,
Validation<E,G> vg)
Accumulates errors anonymously.
|
<A,B,C,D,E$,F$,G,H> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
Validation<E,F$> vf,
Validation<E,G> vg,
F<T,F<A,F<B,F<C,F<D,F<E$,F<F$,F<G,H>>>>>>>> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<A,B,C,D,E$,F$,G,H> |
accumulate(Semigroup<E> s,
Validation<E,A> va,
Validation<E,B> vb,
Validation<E,C> vc,
Validation<E,D> vd,
Validation<E,E$> ve,
Validation<E,F$> vf,
Validation<E,G> vg,
F8<T,A,B,C,D,E$,F$,G,H> f)
Accumulates errors on the failing side of this or any given validation if one or more are encountered, or applies
the given function if all succeeded and returns that value on the successful side.
|
<B,C> Validation<List<E>,C> |
accumulate(Validation<E,B> v2,
F2<T,B,C> f) |
<B,C,D> Validation<List<E>,D> |
accumulate(Validation<E,B> v2,
Validation<E,C> v3,
F3<T,B,C,D> f) |
<B,C,D,$E> Validation<List<E>,$E> |
accumulate(Validation<E,B> v2,
Validation<E,C> v3,
Validation<E,D> v4,
F4<T,B,C,D,$E> f) |
<B,C,D,$E,$F> |
accumulate(Validation<E,B> v2,
Validation<E,C> v3,
Validation<E,D> v4,
Validation<E,$E> v5,
F5<T,B,C,D,$E,$F> f) |
<B,C,D,$E,$F,G> |
accumulate(Validation<E,B> v2,
Validation<E,C> v3,
Validation<E,D> v4,
Validation<E,$E> v5,
Validation<E,$F> v6,
F6<T,B,C,D,$E,$F,G> f) |
<B,C,D,$E,$F,G,H> |
accumulate(Validation<E,B> v2,
Validation<E,C> v3,
Validation<E,D> v4,
Validation<E,$E> v5,
Validation<E,$F> v6,
Validation<E,G> v7,
F7<T,B,C,D,$E,$F,G,H> f) |
<B,C,D,$E,$F,G,H,I> |
accumulate(Validation<E,B> v2,
Validation<E,C> v3,
Validation<E,D> v4,
Validation<E,$E> v5,
Validation<E,$F> v6,
Validation<E,G> v7,
Validation<E,H> v8,
F8<T,B,C,D,$E,$F,G,H,I> f) |
<A> Validation<E,A> |
apply(Validation<E,F<T,A>> v)
Function application on the success value.
|
<A> Validation<E,A> |
bind(F<T,Validation<E,A>> f)
Binds the given function across this validation's success value if it has one.
|
static <E,T> Validation<E,T> |
condition(boolean c,
E e,
T t)
Returns a validation based on a boolean condition.
|
static <E,T> F<Validation<E,T>,Either<E,T>> |
either()
Returns a function that constructs an either with a validation.
|
boolean |
equals(java.lang.Object other) |
boolean |
exists(F<T,java.lang.Boolean> f)
Returns
false if this is a failure or returns the result of the application of the given
function to the success value. |
Validation.FailProjection<E,T> |
f()
Returns a failing projection of this validation.
|
E |
fail()
Returns the failing value, or throws an error if there is no failing value.
|
static <E,T> Validation<E,T> |
fail(E e)
Returns a failing validation containing the given value.
|
static <E,T> Validation<NonEmptyList<E>,T> |
failNEL(E e)
Returns a failing validation containing a non-empty list that contains the given value.
|
static <A,E> List<E> |
fails(List<Validation<E,?>> list) |
<A> Option<Validation<A,T>> |
filter(F<T,java.lang.Boolean> f)
Returns
None if this is a failure or if the given predicate p does not hold for the
success value, otherwise, returns a success in Some . |
boolean |
forall(F<T,java.lang.Boolean> f)
Returns
true if this is a failure or returns the result of the application of the given
function to the success value. |
Unit |
foreach(F<T,Unit> f)
Executes a side-effect on the success value if there is one.
|
void |
foreachDoEffect(Effect1<T> f)
Executes a side-effect on the success value if there is one.
|
int |
hashCode() |
boolean |
isFail()
Returns
true if this is a failure, false otherwise. |
boolean |
isSuccess()
Returns
true if this is a success, false otherwise. |
java.util.Iterator<T> |
iterator()
Returns an iterator for this validation.
|
<A> Validation<E,A> |
map(F<T,A> f)
Maps the given function across the success side of this validation.
|
Validation<NonEmptyList<E>,T> |
nel()
Puts this validation's failing value in a non-empty list if there is one.
|
T |
on(F<E,T> f)
The success value or the application of the given function to the failing value.
|
T |
orSuccess(F0<T> t)
Returns the success value or the given value.
|
T |
orSuccess(T t)
Returns the success value or the given value.
|
static Validation<java.lang.NumberFormatException,java.lang.Byte> |
parseByte(java.lang.String s)
Parses the given string into a byte.
|
static Validation<java.lang.NumberFormatException,java.lang.Double> |
parseDouble(java.lang.String s)
Parses the given string into a double.
|
static Validation<java.lang.NumberFormatException,java.lang.Float> |
parseFloat(java.lang.String s)
Parses the given string into a float.
|
static Validation<java.lang.NumberFormatException,java.lang.Integer> |
parseInt(java.lang.String s)
Parses the given string into a integer.
|
static Validation<java.lang.NumberFormatException,java.lang.Long> |
parseLong(java.lang.String s)
Parses the given string into a long.
|
static Validation<java.lang.NumberFormatException,java.lang.Short> |
parseShort(java.lang.String s)
Parses the given string into a short.
|
static <A,B> P2<List<A>,List<B>> |
partition(List<Validation<A,B>> list)
Partitions the list into the list of fails and the list of successes
|
static <E,A> Validation<E,List<A>> |
sequence(Semigroup<E> s,
List<Validation<E,A>> list)
If list contains a failure, returns a failure of the reduction of
all the failures using the semigroup, otherwise returns the successful list.
|
<A> Validation<E,A> |
sequence(Validation<E,A> v)
Anonymous bind through this validation.
|
static <A,E> Validation<List<E>,List<A>> |
sequenceNonCumulative(List<Validation<E,A>> list)
If the list contains a failure, returns a Validation of the list of
fails in the list, otherwise returns a successful Validation with
the list of successful values.
|
T |
success()
Returns the success value, or throws an error if there is no success value.
|
static <E,T> Validation<E,T> |
success(T t)
Returns a succeeding validation containing the given value.
|
T |
successE(F0<java.lang.String> err)
Returns the success value or fails with the given error message.
|
T |
successE(java.lang.String err)
Returns the success value or fails with the given error message.
|
static <A,E> List<A> |
successes(List<Validation<?,A>> list) |
Array<T> |
toArray()
Returns a single element array if this is a success value, otherwise an empty list.
|
Either<E,T> |
toEither()
Returns an either projection of this validation.
|
List<T> |
toList()
Returns a single element list if this is a success value, otherwise an empty list.
|
Option<T> |
toOption()
Returns the success value in
Some if there is one, otherwise None . |
Stream<T> |
toStream()
Returns a single element stream if this is a success value, otherwise an empty list.
|
java.lang.String |
toString() |
<C> IO<Validation<E,C>> |
traverseIO(F<T,IO<C>> f) |
<C> List<Validation<E,C>> |
traverseList(F<T,List<C>> f) |
<C> Option<Validation<E,C>> |
traverseOption(F<T,Option<C>> f) |
<C> P1<Validation<E,C>> |
traverseP1(F<T,P1<C>> f) |
<C> Stream<Validation<E,C>> |
traverseStream(F<T,Stream<C>> f) |
static <E,T> F<Either<E,T>,Validation<E,T>> |
validation()
Returns a function that constructs a validation with an either.
|
static <E,T> Validation<E,T> |
validation(Either<E,T> e)
Construct a validation using the given either value.
|
<X> X |
validation(F<E,X> fail,
F<T,X> success)
The catamorphism for validation.
|
public static final F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Byte>> parseByte
public static final F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Double>> parseDouble
public static final F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Float>> parseFloat
public static final F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Integer>> parseInt
public static final F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Long>> parseLong
public static final F<java.lang.String,Validation<java.lang.NumberFormatException,java.lang.Short>> parseShort
public final boolean isFail()
true
if this is a failure, false
otherwise.true
if this is a failure, false
otherwise.public final boolean isSuccess()
true
if this is a success, false
otherwise.true
if this is a success, false
otherwise.public final E fail()
public final T success()
public final <X> X validation(F<E,X> fail, F<T,X> success)
fail
- The function to call if this failed.success
- The function to call if this succeeded.public final Validation.FailProjection<E,T> f()
public final Either<E,T> toEither()
public final T successE(F0<java.lang.String> err)
err
- The error message to fail with.public final T successE(java.lang.String err)
err
- The error message to fail with.public final T orSuccess(F0<T> t)
t
- The value to return if this is failure.public final T orSuccess(T t)
t
- The value to return if this is failure.public final T on(F<E,T> f)
f
- The function to execute on the failing value.public final Unit foreach(F<T,Unit> f)
f
- The side-effect to execute.public final void foreachDoEffect(Effect1<T> f)
f
- The side-effect to execute.public final <A> Validation<E,A> map(F<T,A> f)
f
- The function to map.public final <A> Validation<E,A> bind(F<T,Validation<E,A>> f)
f
- The function to bind across this validation.public final <A> Validation<E,A> sequence(Validation<E,A> v)
v
- The value to bind with.public static <E,A> Validation<E,List<A>> sequence(Semigroup<E> s, List<Validation<E,A>> list)
public final <A> Option<Validation<A,T>> filter(F<T,java.lang.Boolean> f)
None
if this is a failure or if the given predicate p
does not hold for the
success value, otherwise, returns a success in Some
.f
- The predicate function to test on this success value.None
if this is a failure or if the given predicate p
does not hold for the
success value, otherwise, returns a success in Some
.public final <A> Validation<E,A> apply(Validation<E,F<T,A>> v)
v
- The validation of the function to apply on the success value.public final boolean forall(F<T,java.lang.Boolean> f)
true
if this is a failure or returns the result of the application of the given
function to the success value.f
- The predicate function to test on this success value.true
if this is a failure or returns the result of the application of the given
function to the success value.public final boolean exists(F<T,java.lang.Boolean> f)
false
if this is a failure or returns the result of the application of the given
function to the success value.f
- The predicate function to test on this success value.false
if this is a failure or returns the result of the application of the given
function to the success value.public final boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final List<T> toList()
public final Option<T> toOption()
Some
if there is one, otherwise None
.Some
if there is one, otherwise None
.public final Array<T> toArray()
public final Stream<T> toStream()
public final <A> Validation<E,A> accumapply(Semigroup<E> s, Validation<E,F<T,A>> v)
s
- The semigroup to accumulate errors with ifv
- The validating function to apply.public final <A,B> Validation<E,B> accumulate(Semigroup<E> s, Validation<E,A> va, F<T,F<A,B>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B> Validation<E,B> accumulate(Semigroup<E> s, Validation<E,A> va, F2<T,A,B> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final <A,B,C> Validation<E,C> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, F<T,F<A,F<B,C>>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C> Validation<E,C> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, F3<T,A,B,C> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final <A,B,C,D> Validation<E,D> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, F<T,F<A,F<B,F<C,D>>>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D> Validation<E,D> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, F4<T,A,B,C,D> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final <A,B,C,D,E$> Validation<E,E$> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, F<T,F<A,F<B,F<C,F<D,E$>>>>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$> Validation<E,E$> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, F5<T,A,B,C,D,E$> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final <A,B,C,D,E$,F$> Validation<E,F$> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, F<T,F<A,F<B,F<C,F<D,F<E$,F$>>>>>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$,F$> Validation<E,F$> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, F6<T,A,B,C,D,E$,F$> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final <A,B,C,D,E$,F$,G> Validation<E,G> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, Validation<E,F$> vf, F<T,F<A,F<B,F<C,F<D,F<E$,F<F$,G>>>>>>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.vf
- The seventh validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$,F$,G> Validation<E,G> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, Validation<E,F$> vf, F7<T,A,B,C,D,E$,F$,G> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.vf
- The seventh validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$,F$> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, Validation<E,F$> vf)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.vf
- The seventh validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final <A,B,C,D,E$,F$,G,H> Validation<E,H> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, Validation<E,F$> vf, Validation<E,G> vg, F<T,F<A,F<B,F<C,F<D,F<E$,F<F$,F<G,H>>>>>>>> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.vf
- The seventh validation to accumulate errors with if it failed.vg
- The eighth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$,F$,G,H> Validation<E,H> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, Validation<E,F$> vf, Validation<E,G> vg, F8<T,A,B,C,D,E$,F$,G,H> f)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.vf
- The seventh validation to accumulate errors with if it failed.vg
- The eighth validation to accumulate errors with if it failed.f
- The function to apply if all validations have succeeded.public final <A,B,C,D,E$,F$,G> Option<E> accumulate(Semigroup<E> s, Validation<E,A> va, Validation<E,B> vb, Validation<E,C> vc, Validation<E,D> vd, Validation<E,E$> ve, Validation<E,F$> vf, Validation<E,G> vg)
s
- The semigroup to accumulate errors with if one or more validations fail.va
- The second validation to accumulate errors with if it failed.vb
- The third validation to accumulate errors with if it failed.vc
- The fourth validation to accumulate errors with if it failed.vd
- The fifth validation to accumulate errors with if it failed.ve
- The sixth validation to accumulate errors with if it failed.vf
- The seventh validation to accumulate errors with if it failed.vg
- The eighth validation to accumulate errors with if it failed.Some
if one or more validations failed (accumulated with the semigroup), otherwise,
None
.public final java.util.Iterator<T> iterator()
for
-each loop.iterator
in interface java.lang.Iterable<T>
public final Validation<List<E>,T> accumulate()
public final <B> Validation<List<E>,B> accumulate(F<T,B> f)
public final <B,C> Validation<List<E>,C> accumulate(Validation<E,B> v2, F2<T,B,C> f)
public final <B,C,D> Validation<List<E>,D> accumulate(Validation<E,B> v2, Validation<E,C> v3, F3<T,B,C,D> f)
public final <B,C,D,$E> Validation<List<E>,$E> accumulate(Validation<E,B> v2, Validation<E,C> v3, Validation<E,D> v4, F4<T,B,C,D,$E> f)
public final <B,C,D,$E,$F> Validation<List<E>,$F> accumulate(Validation<E,B> v2, Validation<E,C> v3, Validation<E,D> v4, Validation<E,$E> v5, F5<T,B,C,D,$E,$F> f)
public final <B,C,D,$E,$F,G> Validation<List<E>,G> accumulate(Validation<E,B> v2, Validation<E,C> v3, Validation<E,D> v4, Validation<E,$E> v5, Validation<E,$F> v6, F6<T,B,C,D,$E,$F,G> f)
public final <B,C,D,$E,$F,G,H> Validation<List<E>,H> accumulate(Validation<E,B> v2, Validation<E,C> v3, Validation<E,D> v4, Validation<E,$E> v5, Validation<E,$F> v6, Validation<E,G> v7, F7<T,B,C,D,$E,$F,G,H> f)
public final <B,C,D,$E,$F,G,H,I> Validation<List<E>,I> accumulate(Validation<E,B> v2, Validation<E,C> v3, Validation<E,D> v4, Validation<E,$E> v5, Validation<E,$F> v6, Validation<E,G> v7, Validation<E,H> v8, F8<T,B,C,D,$E,$F,G,H,I> f)
public static <A,E> Validation<List<E>,List<A>> sequenceNonCumulative(List<Validation<E,A>> list)
public static <A,E> List<E> fails(List<Validation<E,?>> list)
public static <A,E> List<A> successes(List<Validation<?,A>> list)
public final Validation<NonEmptyList<E>,T> nel()
public static <E,T> Validation<E,T> validation(Either<E,T> e)
e
- The either value to construct a validation with.public static <E,T> F<Either<E,T>,Validation<E,T>> validation()
public static <E,T> F<Validation<E,T>,Either<E,T>> either()
public static <E,T> Validation<E,T> success(T t)
t
- The value to use in the succeeding validation.public static <E,T> Validation<E,T> fail(E e)
e
- The value to use in the failing validation.public static <E,T> Validation<NonEmptyList<E>,T> failNEL(E e)
e
- The value to use in a non-empty list for the failing validation.public static <E,T> Validation<E,T> condition(boolean c, E e, T t)
true
, the validation succeeds,
otherwise it fails.c
- The condition to base the returned validation on.e
- The failing value to use if the condition is false
.t
- The succeeding value to use if the condition is true
.public static Validation<java.lang.NumberFormatException,java.lang.Byte> parseByte(java.lang.String s)
s
- The string to parse.public static Validation<java.lang.NumberFormatException,java.lang.Double> parseDouble(java.lang.String s)
s
- The string to parse.public static Validation<java.lang.NumberFormatException,java.lang.Float> parseFloat(java.lang.String s)
s
- The string to parse.public static Validation<java.lang.NumberFormatException,java.lang.Integer> parseInt(java.lang.String s)
s
- The string to parse.public static Validation<java.lang.NumberFormatException,java.lang.Long> parseLong(java.lang.String s)
s
- The string to parse.public static Validation<java.lang.NumberFormatException,java.lang.Short> parseShort(java.lang.String s)
s
- The string to parse.public static <A,B> P2<List<A>,List<B>> partition(List<Validation<A,B>> list)
public final java.lang.String toString()
toString
in class java.lang.Object