Contents
- Validation <F, A>
- IsSuccess
- IsFail
- Match <B> (Func<F, B> Fail, Func<A, B> Succ)
- FailSpan ()
- SuccessSpan ()
- CompareTo <OrdF, OrdA> (Validation<F, A> other)
- Equals <EqF, EqA> (Validation<F, A> other)
- Map <B> (Func<A, B> f)
- BiMap <F1, A1> (Func<F, F1> Fail, Func<A, A1> Succ)
- Bind <B> (Func<A, Validation<F, B>> f)
- BiBind <F1, A1> ( Func<F, Validation<F1, A1>> Fail, Func<A, Validation<F1, A1>> Succ)
- BindFail <F1> ( Func<F, Validation<F1, A>> Fail)
- Match (Action<F> Fail, Action<A> Succ)
- IfFail (Func<A> Fail)
- IfFail (Func<F, A> failMap)
- IfFail (A successValue)
- IfFail (Action<F> Fail)
- IfRight (Action<A> Success)
- CompareTo (object? obj)
- ToList ()
- ToArray ()
- ToSeq ()
- ToIterable ()
- AsEnumerable ()
- ToEither ()
- ToOption ()
- >> (Validation<F, A> lhs, Validation<F, A> rhs)
- < (Validation<F, A> lhs, Fail<F> rhs)
- <= (Validation<F, A> lhs, Fail<F> rhs)
- > (Validation<F, A> lhs, Fail<F> rhs)
- >= (Validation<F, A> lhs, Fail<F> rhs)
- < (Validation<F, A> lhs, Pure<A> rhs)
- <= (Validation<F, A> lhs, Pure<A> rhs)
- > (Validation<F, A> lhs, Pure<A> rhs)
- >= (Validation<F, A> lhs, Pure<A> rhs)
- < (Fail<F> lhs, Validation<F, A> rhs)
- <= (Fail<F> lhs, Validation<F, A> rhs)
- > (Fail<F> lhs, Validation<F, A>rhs)
- >= (Fail<F> lhs, Validation<F, A> rhs)
- < (Pure<A> lhs, Validation<F, A> rhs)
- <= (Pure<A> lhs, Validation<F, A> rhs)
- > (Pure<A> lhs, Validation<F, A> rhs)
- >= (Pure<A> lhs, Validation<F, A> rhs)
- < (Validation<F, A> lhs, Validation<F, A> rhs)
- <= (Validation<F, A> lhs, Validation<F, A> rhs)
- > (Validation<F, A> lhs, Validation<F, A> rhs)
- >= (Validation<F, A> lhs, Validation<F, A> rhs)
- == (Validation<F, A> lhs, Fail<F> rhs)
- == (Validation<F, A> lhs, Pure<A> rhs)
- == (Fail<F> lhs, Validation<F, A> rhs)
- == (Pure<A> lhs, Validation<F, A> rhs)
- != (Validation<F, A> lhs, Fail<F> rhs)
- != (Validation<F, A> lhs, Pure<A> rhs)
- != (Fail<F> lhs, Validation<F, A> rhs)
- != (Pure<A> lhs, Validation<F, A> rhs)
- & (Validation<F, A> lhs, Validation<F, A> rhs)
- & (Validation<F, Seq<A>> lhs, Validation<F, A> rhs)
- & (Validation<F, A> lhs, Validation<F, Seq<A>> rhs)
- | (Validation<F, A> lhs, Validation<F, A> rhs)
- true (Validation<F, A> value)
- false (Validation<F, A> value)
- CompareTo (Validation<F, A>? other)
- CompareTo <OrdR> (Validation<F, A> other)
- CompareTo (Fail<F> other)
- CompareTo (Pure<A> other)
- CompareTo (A? other)
- CompareTo (F? other)
- Equals (A? other)
- Equals (F? other)
- Equals (Validation<F, A>? other)
- Equals <EqR> (Validation<F, A> other)
- Equals (Fail<F> other)
- Equals (Pure<A> other)
- MatchUntyped <B> (Func<object?, B> Succ, Func<object?, B> Fail)
- Iter (Action<A> Succ)
- ForAll (Func<A, bool> Succ)
- BiForAll (Func<F, bool> Fail, Func<A, bool> Succ)
- Fold <S> (S state, Func<S, A, S> Succ)
- BiFold <S> (S state, Func<S, F, S> Fail, Func<S, A, S> Succ)
- Exists (Func<A, bool> pred)
- Do (Action<A> f)
- Traverse <AF, B> (Func<A, K<AF, B>> f)
- MapFail <F1> (Func<F, F1> f)
- Bind <B> (Func<A, K<Validation<F>, B>> f)
- Select <B> (Func<A, B> f)
- SelectMany <S, B> (Func<A, Validation<F, S>> bind, Func<A, S, B> project)
- Bind <B> (Func<A, Pure<B>> f)
- Bind (Func<A, Fail<F>> f)
- Bind (Func<A, Guard<F, Unit>> f)
- SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, Fail<F>> bind, Func<A, B, C> _)
- SelectMany <C> ( Func<A, Guard<F, Unit>> f, Func<A, Unit, C> project)
- GetHashCode ()
- ValidationContext <F, A, B>
- ValidationUnitContext <F, A>
- Validation <F, A>
- Fail (F Value)
- IsSuccess
- IsFail
- Match <B> (Func<F, B> Fail, Func<A, B> Succ)
- ToString ()
- GetHashCode ()
- FailSpan ()
- SuccessSpan ()
- CompareTo <OrdF, OrdA> (Validation<F, A> other)
- Equals <EqF, EqA> (Validation<F, A> other)
- Map <B> (Func<A, B> f)
- BiMap <L2, R2> (Func<F, L2> Fail, Func<A, R2> Succ)
- Bind <B> (Func<A, Validation<F, B>> f)
- BiBind <L2, R2> ( Func<F, Validation<L2, R2>> Fail, Func<A, Validation<L2, R2>> Succ)
- Validation
- Validation <F, A>
- Success (A Value)
- IsSuccess
- IsFail
- Match <B> ( Func<F, B> Fail, Func<A, B> Succ)
- ToString ()
- GetHashCode ()
- FailSpan ()
- SuccessSpan ()
- CompareTo <OrdF, OrdA> (Validation<F, A> other)
- Equals <EqF, EqA> (Validation<F, A> other)
- Map <B> (Func<A, B> f)
- BiMap <L2, R2> ( Func<F, L2> Fail, Func<A, R2> Succ)
- Bind <B> (Func<A, Validation<F, B>> f)
- BiBind <L2, R2> ( Func<F, Validation<L2, R2>> Fail, Func<A, Validation<L2, R2>> Succ)
Sub modules
| Extensions |
| Operators |
| Prelude |
| Trait |
record Validation <F, A> Source #
Like Either but collects multiple failed values
Parameters
| type | F | Failure value type: it is important that this implements |
| type | A | Success value type |
Properties
Methods
method B Match <B> (Func<F, B> Fail, Func<A, B> Succ) Source #
Invokes the Success or Fail function depending on the state of the Validation
Parameters
| type | B | Return type |
| param | Fail | Function to invoke if in a Fail state |
| param | Succ | Function to invoke if in a Success state |
| returns | The return value of the invoked function | |
method ReadOnlySpan<A> SuccessSpan () Source #
Span of right value
method int CompareTo <OrdF, OrdA> (Validation<F, A> other) Source #
Compare this structure to another to find its relative ordering
method bool Equals <EqF, EqA> (Validation<F, A> other) Source #
Equality override
method Validation<F, B> Map <B> (Func<A, B> f) Source #
Maps the value in the Validation if it's in a Success state
Parameters
| type | F | Fail |
| type | A | Success |
| type | B | Mapped Validation type |
| param | f | Map function |
| returns | Mapped Validation | |
method Validation<F1, A1> BiMap <F1, A1> (Func<F, F1> Fail, Func<A, A1> Succ) Source #
Bi-maps the value in the Validation if it's in a Success state
Parameters
| type | F | Fail |
| type | A | Success |
| type | F1 | Fail return |
| type | A1 | Success return |
| param | Succ | Success map function |
| param | Fail | Fail map function |
| returns | Mapped Validation | |
method Validation<F, B> Bind <B> (Func<A, Validation<F, B>> f) Source #
Monadic bind
Parameters
| type | F | Fail |
| type | A | Success |
| type | B | Resulting bound value |
| param | f | Bind function |
| returns | Bound Validation | |
method Validation<F1, A1> BiBind <F1, A1> ( Func<F, Validation<F1, A1>> Fail, Func<A, Validation<F1, A1>> Succ) Source #
Bi-bind. Allows mapping of both monad states
method Validation<F1, A> BindFail <F1> ( Func<F, Validation<F1, A>> Fail) Source #
Bind the failure
method Unit Match (Action<F> Fail, Action<A> Succ) Source #
Invokes the Succ or Fail action depending on the state of the value
Parameters
| param | Fail | Action to invoke if in a Fail state |
| param | Succ | Action to invoke if in a Success state |
| returns | Unit | |
method A IfFail (Func<A> Fail) Source #
Executes the Fail function if the value is in a Fail state.
Returns the Success value if the value is in a Success state.
Parameters
| param | Fail | Function to generate a value if in the Fail state |
| returns | Returns an unwrapped value | |
method A IfFail (Func<F, A> failMap) Source #
Executes the failMap function if the value is in a Fail state.
Returns the Success value if in a Success state.
Parameters
| param | failMap | Function to generate a value if in the Fail state |
| returns | Returns an unwrapped value | |
method A IfFail (A successValue) Source #
Returns the successValue if in a Fail state.
Returns the Success value if in a Success state.
Parameters
| param | successValue | Value to return if in the Fail state |
| returns | Returns an unwrapped value | |
method Unit IfFail (Action<F> Fail) Source #
Executes the Fail action if in a Fail state.
Parameters
| param | Fail | Function to generate a Success value if in the Fail state |
| returns | Unit | |
method Unit IfRight (Action<A> Success) Source #
Invokes the Success action if in a Success state, otherwise does nothing
Parameters
| param | Success | Action to invoke |
| returns | Unit | |
method Lst<A> ToList () Source #
Project into a Lst〈A〉
Parameters
| returns | If in a Success state, a | |
method Arr<A> ToArray () Source #
Project into an Arr〈A〉
Parameters
| returns | If in a Success state, an | |
method Iterable<A> ToIterable () Source #
Convert to sequence of 0 or 1 success values
method IEnumerable<A> AsEnumerable () Source #
Convert to sequence of 0 or 1 success values
method int CompareTo <OrdR> (Validation<F, A> other) Source #
CompareTo override
method B MatchUntyped <B> (Func<object?, B> Succ, Func<object?, B> Fail) Source #
Match the Success and Fail values but as untyped objects.
method Unit Iter (Action<A> Succ) Source #
Iterate the value action is invoked if in the Success state
method bool ForAll (Func<A, bool> Succ) Source #
Invokes a predicate on the success value if it's in the Success state
Parameters
| returns | True if in a | |
method bool BiForAll (Func<F, bool> Fail, Func<A, bool> Succ) Source #
Invokes a predicate on the values
Parameters
| type | L | Left |
| type | R | Right |
| param | self | Either to forall |
| param | Succ | Predicate |
| param | Fail | Predicate |
| returns | True if either Predicate returns true | |
method S Fold <S> (S state, Func<S, A, S> Succ) Source #
Validation types are like lists of 0 or 1 items and therefore follow the same rules when folding.
Parameters
| type | S | Aggregate state type |
| param | state | Initial state |
| param | Succ | Folder function, applied if structure is in a Success state |
| returns | The aggregate state | |
method S BiFold <S> (S state, Func<S, F, S> Fail, Func<S, A, S> Succ) Source #
Either types are like lists of 0 or 1 items, and therefore follow the Validation types are like lists of 0 or 1 items and therefore follow the same rules when folding.
Parameters
| type | S | Aggregate state type |
| param | state | Initial state |
| param | Succ | Folder function, applied if in a Success state |
| param | Fail | Folder function, applied if in a Fail state |
| returns | The aggregate state | |
method bool Exists (Func<A, bool> pred) Source #
Invokes a predicate on the value if it's in the Success state
Parameters
| param | pred | Predicate |
| returns | True if in a Success state and the predicate returns | |
method Validation<F, A> Do (Action<A> f) Source #
Impure iteration of the bound values in the structure
Parameters
| returns | Returns the original unmodified structure | |
method K<AF, Validation<F, B>> Traverse <AF, B> (Func<A, K<AF, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
Parameters
| type | F | Applicative functor trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method Validation<F1, A> MapFail <F1> (Func<F, F1> f) Source #
Maps the value in the Either if it's in a Left state
Parameters
| type | L | Left |
| type | R | Right |
| type | F1 | Mapped Either type |
| param | f | Map function |
| returns | Mapped Either | |
method Validation<F, B> Bind <B> (Func<A, K<Validation<F>, B>> f) Source #
Monadic bind
Parameters
| type | L | Left |
| type | R | Right |
| type | B | |
| param | f | |
| returns | Bound Either | |
method Validation<F, B> SelectMany <S, B> (Func<A, Validation<F, S>> bind, Func<A, S, B> project) Source #
Monadic bind function
method Validation<F, B> Bind <B> (Func<A, Pure<B>> f) Source #
Monadic bind
Parameters
| param | f | Bind function |
method Validation<F, A> Bind (Func<A, Fail<F>> f) Source #
Monadic bind
Parameters
| param | f | Bind function |
method Validation<F, Unit> Bind (Func<A, Guard<F, Unit>> f) Source #
Monadic bind
Parameters
| param | f | Bind function |
method Validation<F, C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #
Monadic bind and project
Parameters
| param | bind | Bind function |
| param | project | Project function |
method Validation<F, C> SelectMany <B, C> (Func<A, Fail<F>> bind, Func<A, B, C> _) Source #
Monadic bind and project
Parameters
| param | bind | Bind function |
| param | project | Project function |
method Validation<F, C> SelectMany <C> ( Func<A, Guard<F, Unit>> f, Func<A, Unit, C> project) Source #
Monadic bind and project
Parameters
| param | bind | Bind function |
| param | project | Project function |
method int GetHashCode () Source #
Operators
operator < (Validation<F, A> lhs, Fail<F> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈 rhs | |
operator <= (Validation<F, A> lhs, Fail<F> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈= rhs | |
operator > (Validation<F, A> lhs, Fail<F> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉rhs | |
operator >= (Validation<F, A> lhs, Fail<F> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉= rhs | |
operator < (Validation<F, A> lhs, Pure<A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈 rhs | |
operator <= (Validation<F, A> lhs, Pure<A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈= rhs | |
operator > (Validation<F, A> lhs, Pure<A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉rhs | |
operator >= (Validation<F, A> lhs, Pure<A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉= rhs | |
operator < (Fail<F> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈 rhs | |
operator <= (Fail<F> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈= rhs | |
operator > (Fail<F> lhs, Validation<F, A>rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉rhs | |
operator >= (Fail<F> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉= rhs | |
operator < (Pure<A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈 rhs | |
operator <= (Pure<A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈= rhs | |
operator > (Pure<A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉rhs | |
operator >= (Pure<A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉= rhs | |
operator < (Validation<F, A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈 rhs | |
operator <= (Validation<F, A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs〈= rhs | |
operator > (Validation<F, A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉rhs | |
operator >= (Validation<F, A> lhs, Validation<F, A> rhs) Source #
Comparison operator
Parameters
| param | lhs | The left-hand side of the operation |
| param | rhs | The right-hand side of the operation |
| returns | True if lhs 〉= rhs | |
operator & (Validation<F, A> lhs, Validation<F, A> rhs) Source #
If any items are Fail, then the errors are collected and returned. If they all pass, then the Success values
are collected into a Seq.
operator & (Validation<F, Seq<A>> lhs, Validation<F, A> rhs) Source #
If any items are Fail, then the errors are collected and returned. If they all pass, then the Success values
are collected into a Seq.
operator & (Validation<F, A> lhs, Validation<F, Seq<A>> rhs) Source #
If any items are Fail, then the errors are collected and returned. If they all pass, then the Success values
are collected into a Seq.
operator | (Validation<F, A> lhs, Validation<F, A> rhs) Source #
Must exist here to make operator true work
struct ValidationContext <F, A, B> Source #
Context for the fluent Either matching
struct ValidationUnitContext <F, A> Source #
Context for the fluent Validation matching
record Validation <F, A> Source #
record Fail (F Value) Source #
Properties
Methods
method B Match <B> (Func<F, B> Fail, Func<A, B> Succ) Source #
Invokes the Success or Fail function depending on the state of the Validation
Parameters
| type | B | Return type |
| param | Succ | Function to invoke if in a Success state |
| param | Fail | Function to invoke if in a Fail state |
| returns | The return value of the invoked function | |
method int GetHashCode () Source #
Get a hash code for the structure
method ReadOnlySpan<A> SuccessSpan () Source #
Empty span
method int CompareTo <OrdF, OrdA> (Validation<F, A> other) Source #
Compare this structure to another to find its relative ordering
method Validation<F, B> Map <B> (Func<A, B> f) Source #
Maps the value in the Validation if it's in a Success state
Parameters
| type | F | Fail |
| type | A | Success |
| type | B | Mapped Validation type |
| param | f | Map function |
| returns | Mapped Validation | |
method Validation<L2, R2> BiMap <L2, R2> (Func<F, L2> Fail, Func<A, R2> Succ) Source #
Bi-maps the value in the Validation if it's in a Success state
Parameters
| type | F | Fail |
| type | A | Success |
| type | L2 | Fail return |
| type | R2 | Success return |
| param | Succ | Success map function |
| param | Fail | Fail map function |
| returns | Mapped Validation | |
class Validation Source #
Methods
method Validation<F, A> Empty <F, A> () Source #
Empty failure value
Parameters
| type | F | Failure type |
| type | A | Success |
| returns | Validation structure in a failed state | |
method Validation<F, A> Success <F, A> (A value) Source #
Represents a successful operation
Parameters
| type | F | Error type |
| type | A | Value type |
| param | value | Value |
| returns | Validation applicative | |
record Validation <F, A> Source #
record Success (A Value) Source #
Properties
Methods
method B Match <B> ( Func<F, B> Fail, Func<A, B> Succ) Source #
Invokes the Success or Left function depending on the state of the Validation
Parameters
| type | B | Return type |
| param | Left | Function to invoke if in a Left state |
| param | Success | Function to invoke if in a Success state |
| returns | The return value of the invoked function | |
method int GetHashCode () Source #
Get a hash code for the structure
method ReadOnlySpan<A> SuccessSpan () Source #
Span of right value
method int CompareTo <OrdF, OrdA> (Validation<F, A> other) Source #
Compare this structure to another to find its relative ordering
method Validation<F, B> Map <B> (Func<A, B> f) Source #
Maps the value in the Validation if it's in a Success state
Parameters
| type | F | Left |
| type | A | Success |
| type | B | Mapped Validation type |
| param | f | Map function |
| returns | Mapped Validation | |
method Validation<L2, R2> BiMap <L2, R2> ( Func<F, L2> Fail, Func<A, R2> Succ) Source #
Bi-maps the value in the Validation if it's in a Success state
Parameters
| type | F | Left |
| type | A | Success |
| type | L2 | Left return |
| type | R2 | Success return |
| param | Success | Success map function |
| param | Fail | Left map function |
| returns | Mapped Validation | |