The Fin monad supports either an Error or an A (success) value. It is functionally exactly the same as Either<Error, A>, it is a
convenience type to avoid the generics pain of Either.
To construct a Fin:
Fin<int> ma = Pure(123);
Fin<int> mb = Fail(Error.New("Error!"));
Contents
- Fin <A>
- IsSucc
- IsFail
- Match <B> (Func<A, B> Succ, Func<Error, B> Fail)
- FailSpan ()
- SuccSpan ()
- CompareTo <OrdA> (Fin<A> other)
- Equals <EqA> (Fin<A> other)
- Equals (Fin<A>? other)
- Equals (object? other)
- GetHashCode <HashA> ()
- GetHashCode ()
- Map <B> (Func<A, B> f)
- MapFail (Func<Error, Error> f)
- BiMap <B> (Func<A, B> Succ, Func<Error, Error> Fail)
- Bind <B> (Func<A, Fin<B>> f)
- BiBind <B> (Func<A, Fin<B>> Succ, Func<Error, Fin<B>> Fail)
- BindFail (Func<Error, Fin<A>> Fail)
- Empty
- | (Fin<A> lhs, Fin<A> rhs)
- true (Fin<A> ma)
- false (Fin<A> ma)
- == (Fin<A> ma, Fin<A> mb)
- != (Fin<A> ma, Fin<A> mb)
- < (Fin<A> lhs, A rhs)
- <= (Fin<A> lhs, A rhs)
- > (Fin<A> lhs, A rhs)
- >= (Fin<A> lhs, A rhs)
- < (A lhs, Fin<A> rhs)
- <= (A lhs, Fin<A> rhs)
- > (A lhs, Fin<A>rhs)
- >= (A lhs, Fin<A> rhs)
- < (Fin<A> lhs, Fin<A> rhs)
- <= (Fin<A> lhs, Fin<A> rhs)
- > (Fin<A> lhs, Fin<A> rhs)
- >= (Fin<A> lhs, Fin<A> rhs)
- == (Fin<A> lhs, Error rhs)
- == (Fin<A> lhs, A rhs)
- == (A lhs, Fin<A> rhs)
- == (Error lhs, Fin<A> rhs)
- != (Fin<A> lhs, Error rhs)
- != (Error lhs, Fin<A> rhs)
- != (Fin<A> lhs, A rhs)
- != (A lhs, Fin<A> rhs)
- CompareTo (Fin<A>? other)
- CompareTo (object? obj)
- Match (Action<A> Succ, Action<Error> Fail)
- IfFail (Func<Error, A> Fail)
- IfFail (A alternative)
- IfFail (Action<Error> Fail)
- IfSucc (Action<A> Succ)
- Iter (Action<A> Succ)
- Fold <S> (S state, Func<S, A, S> f)
- BiFold <S> (in S state, Func<S, A, S> Succ, Func<S, Error, S> Fail)
- Exists (Func<A, bool> f)
- ForAll (Func<A, bool> f)
- Traverse <F, B> (Func<A, K<F, B>> f)
- TraverseM <M, B> (Func<A, K<M, B>> f)
- Select <B> (Func<A, B> f)
- Bind <B> (Func<A, K<Fin, B>> f)
- Bind <B> (Func<A, Pure<B>> f)
- Bind (Func<A, Fail<Error>> f)
- SelectMany <B, C> (Func<A, Fin<B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, K<Fin, B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project)
- SelectMany (Func<A, Fail<Error>> bind, Func<A, Error, Unit> project)
- SelectMany (Func<A, Guard<Error, Unit>> f)
- SelectMany <C> (Func<A, Guard<Error, Unit>> bind, Func<A, Unit, C> project)
- AsEnumerable ()
- ToIterable ()
- ToList ()
- ToSeq ()
- ToArray ()
- ToOption ()
- ToEither ()
- ToValidation ()
- ToEff ()
- ThrowIfFail ()
- Fin <A>
- Fail
- Error
- IsSucc
- IsFail
- Match <B> (Func<A, B> Succ, Func<Error, B> Fail)
- ToString ()
- GetHashCode <HashA> ()
- FailSpan ()
- SuccSpan ()
- CompareTo <OrdA> (Fin<A> other)
- Equals <EqA> (Fin<A> other)
- Map <B> (Func<A, B> f)
- MapFail (Func<Error, Error> f)
- BiMap <B> (Func<A, B> Succ, Func<Error, Error> Fail)
- Bind <B> (Func<A, Fin<B>> f)
- BiBind <B> ( Func<A, Fin<B>> Succ, Func<Error, Fin<B>> Fail)
- Deconstruct (out Error value)
- Fin
- Fin <A>
- Succ
- Value
- IsSucc
- IsFail
- Match <B> (Func<A, B> Succ, Func<Error, B> Fail)
- ToString ()
- GetHashCode <HashA> ()
- FailSpan ()
- SuccSpan ()
- CompareTo <OrdA> (Fin<A>? other)
- Equals <EqA> (Fin<A> other)
- Map <B> (Func<A, B> Succ)
- MapFail (Func<Error, Error> f)
- BiMap <B> (Func<A, B> Succ, Func<Error, Error> Fail)
- Bind <B> (Func<A, Fin<B>> f)
- BiBind <B> ( Func<A, Fin<B>> Succ, Func<Error, Fin<B>> Fail)
- Deconstruct (out A value)
Sub modules
| Extensions |
| Operators |
| Trait |
Equivalent of Either〈Error, A〉
Called Fin because it is expected to be used as the concrete result of a computation
Properties
Methods
method B Match <B> (Func<A, B> Succ, Func<Error, B> Fail) Source #
Invokes the Succ or Fail function depending on the state of the structure
Parameters
| type | B | Return type |
| param | Succ | Function to invoke if in a Succ state |
| param | Fail | Function to invoke if in a Fail state |
| returns | The return value of the invoked function | |
method int CompareTo <OrdA> (Fin<A> other) Source #
Compare this structure to another to find its relative ordering
method int GetHashCode () Source #
method Fin<B> Map <B> (Func<A, B> f) Source #
Maps the value in the structure
Parameters
| param | f | Map function |
| returns | Mapped structure | |
method Fin<A> MapFail (Func<Error, Error> f) Source #
Maps the value in the structure
Parameters
| param | f | Map function |
| returns | Mapped structure | |
method Fin<B> BiMap <B> (Func<A, B> Succ, Func<Error, Error> Fail) Source #
Bi-maps the structure
Parameters
| returns | Mapped Either | |
method Fin<B> Bind <B> (Func<A, Fin<B>> f) Source #
Monadic bind
Parameters
| type | B | Resulting bound value |
| param | f | Bind function |
| returns | Bound structure | |
method Fin<B> BiBind <B> (Func<A, Fin<B>> Succ, Func<Error, Fin<B>> Fail) Source #
Bi-bind. Allows mapping of both monad states
method K<F, Fin<B>> Traverse <F, B> (Func<A, K<F, 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 K<M, Fin<B>> TraverseM <M, B> (Func<A, K<M, 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 | M | Monad trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method Fin<C> SelectMany <B, C> (Func<A, Fin<B>> bind, Func<A, B, C> project) Source #
method Fin<C> SelectMany <B, C> (Func<A, K<Fin, B>> bind, Func<A, B, C> project) Source #
method Fin<C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #
method Fin<Unit> SelectMany (Func<A, Fail<Error>> bind, Func<A, Error, Unit> project) Source #
method Fin<Unit> SelectMany (Func<A, Guard<Error, Unit>> f) Source #
method Fin<C> SelectMany <C> (Func<A, Guard<Error, Unit>> bind, Func<A, Unit, C> project) Source #
method IEnumerable<A> AsEnumerable () Source #
method Iterable<A> ToIterable () Source #
method Validation<Error, A> ToValidation () Source #
method A ThrowIfFail () Source #
Operators
operator < (Fin<A> lhs, 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 <= (Fin<A> lhs, 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 > (Fin<A> lhs, 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 >= (Fin<A> lhs, 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 < (A lhs, Fin<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 <= (A lhs, Fin<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 > (A lhs, Fin<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 >= (A lhs, Fin<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 < (Fin<A> lhs, Fin<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 <= (Fin<A> lhs, Fin<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 > (Fin<A> lhs, Fin<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 | |
Fail case for the Fin union-type
Parameters
| param | Error | Error value |
Properties
Methods
method B Match <B> (Func<A, B> Succ, Func<Error, B> Fail) Source #
Invokes the Succ or Fail function depending on the state of the structure
Parameters
| type | B | Return type |
| param | Succ | Function to invoke if in a Succ state |
| param | Fail | Function to invoke if in a Fail state |
| returns | The return value of the invoked function | |
method int GetHashCode <HashA> () Source #
method int CompareTo <OrdA> (Fin<A> other) Source #
Compare this structure to another to find its relative ordering
method Fin<B> Map <B> (Func<A, B> f) Source #
Maps the value in the structure
Parameters
| param | f | Map function |
| returns | Mapped structure | |
method Fin<A> MapFail (Func<Error, Error> f) Source #
Maps the value in the structure
Parameters
| param | f | Map function |
| returns | Mapped structure | |
method Fin<B> BiMap <B> (Func<A, B> Succ, Func<Error, Error> Fail) Source #
Bi-maps the structure
Parameters
| returns | Mapped Either | |
method Fin<B> Bind <B> (Func<A, Fin<B>> f) Source #
Monadic bind
Parameters
| type | B | Resulting bound value |
| param | f | Bind function |
| returns | Bound structure | |
method Fin<B> BiBind <B> ( Func<A, Fin<B>> Succ, Func<Error, Fin<B>> Fail) Source #
Bi-bind. Allows mapping of both monad states
method void Deconstruct (out Error value) Source #
Methods
method Fin<A> Succ <A> (A value) Source #
Construct a Fin value in a Succ state (success)
Parameters
| type | A | Value type |
| param | value | Value to construct the |
| returns | Constructed | |
Success case for the Fin union-type
Parameters
| param | Value | Success value |
Properties
Methods
method B Match <B> (Func<A, B> Succ, Func<Error, B> Fail) Source #
Invokes the Succ or Fail function depending on the state of the structure
Parameters
| type | B | Return type |
| param | Succ | Function to invoke if in a Succ state |
| param | Fail | Function to invoke if in a Fail state |
| returns | The return value of the invoked function | |
method int GetHashCode <HashA> () Source #
Get a hash code for the structure
method int CompareTo <OrdA> (Fin<A>? other) Source #
Compare this structure to another to find its relative ordering
method Fin<B> Map <B> (Func<A, B> Succ) Source #
Maps the value in the structure
Parameters
| param | f | Map function |
| returns | Mapped structure | |
method Fin<A> MapFail (Func<Error, Error> f) Source #
Maps the value in the structure
Parameters
| param | f | Map function |
| returns | Mapped structure | |
method Fin<B> BiMap <B> (Func<A, B> Succ, Func<Error, Error> Fail) Source #
Bi-maps the structure
Parameters
| returns | Mapped Either | |
method Fin<B> Bind <B> (Func<A, Fin<B>> f) Source #
Monadic bind
Parameters
| type | B | Resulting bound value |
| param | f | Bind function |
| returns | Bound structure | |
method Fin<B> BiBind <B> ( Func<A, Fin<B>> Succ, Func<Error, Fin<B>> Fail) Source #
Bi-bind. Allows mapping of both monad states
method void Deconstruct (out A value) Source #