Validation
case Success(t)case Failure(Nec[e])The Validation type.
Instances
instance Applicative[Validation[e]]Sourceinstance Formattable[Validation[e, t]] with Formattable[e], Formattable[t]SourceDefinitions
Applies the function in v1 to the value in v2.
Returns true if and only if v is Success(t) and f(t) is true.
Returns false if v is Failure.
Returns true if v is Success(t) and f(t) is true or if v is Failure.
Returns t if v is Success(t). Otherwise returns d.
Returns Success(f(t)) if v is Success(t). Otherwise returns v.
def map10(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> (t8 -> (t9 -> (t10 -> u \ ef))))))))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4], v5: Validation[e, t5], v6: Validation[e, t6], v7: Validation[e, t7], v8: Validation[e, t8], v9: Validation[e, t9], v10: Validation[e, t10]): Validation[e, u] \ ef§ SourceApplies the 10-ary function f to the values in v1, v2, ... v10.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, ... v10 are Failure(xs1).
def map2(f: t1 -> (t2 -> u \ ef), v1: Validation[e, t1], v2: Validation[e, t2]): Validation[e, u] \ ef§ SourceApplies the binary function f to the values in v1 and v2.
Returns the concatenation of all the failures as Failure(xs) if either or both of v1 or v2 are Failure(xs1).
def map3(f: t1 -> (t2 -> (t3 -> u \ ef)), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3]): Validation[e, u] \ ef§ SourceApplies the ternary function f to the values in v1, v2 and v3.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2 and v3 are Failure(xs1).
def map4(f: t1 -> (t2 -> (t3 -> (t4 -> u \ ef))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4]): Validation[e, u] \ ef§ SourceApplies the 4-ary function f to the values in v1, v2, v3 and v4.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, v3 and v4 are Failure(xs1).
def map5(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> u \ ef)))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4], v5: Validation[e, t5]): Validation[e, u] \ ef§ SourceApplies the 5-ary function f to the values in v1, v2, ... v5.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, ... v5 are Failure(xs1).
def map6(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> u \ ef))))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4], v5: Validation[e, t5], v6: Validation[e, t6]): Validation[e, u] \ ef§ SourceApplies the 6-ary function f to the values in v1, v2, ... v6.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, ... v6 are Failure(xs1).
def map7(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> u \ ef)))))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4], v5: Validation[e, t5], v6: Validation[e, t6], v7: Validation[e, t7]): Validation[e, u] \ ef§ SourceApplies the 7-ary function f to the values in v1, v2, ... v7.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, ... v7 are Failure(xs1).
def map8(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> (t8 -> u \ ef))))))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4], v5: Validation[e, t5], v6: Validation[e, t6], v7: Validation[e, t7], v8: Validation[e, t8]): Validation[e, u] \ ef§ SourceApplies the 8-ary function f to the values in v1, v2, ... v8.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, ... v8 are Failure(xs1).
def map9(f: t1 -> (t2 -> (t3 -> (t4 -> (t5 -> (t6 -> (t7 -> (t8 -> (t9 -> u \ ef)))))))), v1: Validation[e, t1], v2: Validation[e, t2], v3: Validation[e, t3], v4: Validation[e, t4], v5: Validation[e, t5], v6: Validation[e, t6], v7: Validation[e, t7], v8: Validation[e, t8], v9: Validation[e, t9]): Validation[e, u] \ ef§ SourceApplies the 9-ary function f to the values in v1, v2, ... v9.
Returns the concatenation of all the failures as Failure(xs) if any of v1, v2, ... v9 are Failure(xs1).
Chain two functions, returns the product of their results.
def product3(fa: Validation[e, t1], fb: Validation[e, t2], fc: Validation[e, t3]): Validation[e, (t1, t2, t3)]§ SourceChain three functions, returns the product of their results.
def product4(fa: Validation[e, t1], fb: Validation[e, t2], fc: Validation[e, t3], fd: Validation[e, t4]): Validation[e, (t1, t2, t3, t4)]§ SourceChain four functions, returns the product of their results.
def product5(fa: Validation[e, t1], fb: Validation[e, t2], fc: Validation[e, t3], fd: Validation[e, t4], fe: Validation[e, t5]): Validation[e, (t1, t2, t3, t4, t5)]§ SourceChain five functions, returns the product of their results.
Returns Success(v1 :: v2 :: ... :: vn) if each of l_i is Success(v_i).
Otherwise returns Failure(e1 :: ... :: en) with all of the failures concatenated.
Converts a Validation to a List.
Returns t :: Nil if v is Success(t).
Returns Nil if v is Failure(e).
Converts a Validation to an Option.
Returns Some(t) if v is Success(t).
Returns None otherwise.
Converts a Validation to a Result.
Returns Ok(t) if v is Success(t).
Returns Err(e) if v is Failure(e).
Returns Success(v1 :: v2 :: ... v :: vn) if each of f(l_i) is Success(v_i).
Otherwise returns Failure(e1 :: ... :: en) with all of the failures concatenated.
Returns Success() if each of f(l_i) is Success(_).
Otherwise returns Failure(e1 :: ... :: en) with all of the failures concatenated.
This function is the "forgetful" version of traverse, use it when you want the effect
of applying f to each element but do not care about collecting the results.