- EitherUnsafe <L, R>
- Bottom = new EitherUnsafe<L, R>()
- GetObjectData (SerializationInfo info, StreamingContext context)
- EitherUnsafe (IEnumerable<EitherData<L, R>> either)
- GetEnumerator ()
- State
- IsRight
- IsLeft
- IsBottom
- Case
- MatchUnsafe <Ret> (Func<R, Ret> Right, Func<L, Ret> Left, Func<Ret> Bottom = null)
- MatchUnsafe (Action<R> Right, Action<L> Left, Action Bottom = null)
- IfLeftUnsafe (Func<R> Left)
- IfLeftUnsafe (Func<L, R> leftMap)
- IfLeftUnsafe (R rightValue)
- IfLeftUnsafe (Action<L> Left)
- IfRightUnsafe (Action<R> Right)
- IfRightUnsafe (L leftValue)
- IfRightUnsafe (Func<L> Right)
- IfRightUnsafe (Func<R, L> rightMap)
- Right (Action<R> right)
- Right <Ret> (Func<R, Ret> right)
- ToString ()
- GetHashCode ()
- CompareTo (object obj)
- Equals (object obj)
- ToList ()
- ToArray ()
- RightToList ()
- RightToArray ()
- LeftToList ()
- LeftToArray ()
- ToSeq ()
- RightToSeq ()
- LeftToSeq ()
- RightAsEnumerable ()
- LeftAsEnumerable ()
- ToValidation ()
- ToOption ()
- ToEff (Func<L, Common.Error> Left)
- ToAff (Func<L, Common.Error> Left)
- ToEither ()
- < (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- <= (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- > (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- >= (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- == (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- != (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- | (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs)
- true (EitherUnsafe<L, R> value)
- false (EitherUnsafe<L, R> value)
- CompareTo (EitherUnsafe<L, R> other)
- CompareTo (R other)
- CompareTo (L other)
- Equals (R other)
- Equals (L other)
- Equals (EitherUnsafe<L, R> other)
- MatchUntyped <TResult> (Func<object, TResult> Right, Func<object, TResult> Left)
- GetUnderlyingRightType ()
- GetUnderlyingLeftType ()
- Right (R value)
- Left (L value)
- MatchUntyped <R1> (Func<object, R1> Some, Func<R1> None)
- GetUnderlyingType ()
- Count ()
- Swap ()
- Iter (Action<R> Right)
- BiIter (Action<R> Right, Action<L> Left)
- ForAll (Func<R, bool> Right)
- BiForAll (Func<R, bool> Right, Func<L, bool> Left)
- Fold <S> (S state, Func<S, R, S> Right)
- BiFold <S> (S state, Func<S, R, S> Right, Func<S, L, S> Left)
- Exists (Func<R, bool> pred)
- BiExists (Func<R, bool> Right, Func<L, bool> Left)
- Do (Action<R> f)
- Map <Ret> (Func<R, Ret> mapper)
- MapLeft <Ret> (Func<L, Ret> mapper)
- BiMap <Ret> (Func<R, Ret> Right, Func<L, Ret> Left)
- BiMap <L2, R2> (Func<R, R2> Right, Func<L, L2> Left)
- Bind <Ret> (Func<R, EitherUnsafe<L, Ret>> binder)
- BiBind <B> (Func<R, EitherUnsafe<L, B>> Right, Func<L, EitherUnsafe<L, B>> Left)
- BindLeft <B> (Func<L, EitherUnsafe<B, R>> f)
- Filter (Func<R, bool> pred)
- Where (Func<R, bool> pred)
- Select <U> (Func<R, U> map)
- SelectMany <U, V> (Func<R, EitherUnsafe<L, U>> bind, Func<R, U, V> project)
- Join <U, K, V> ( EitherUnsafe<L, U> inner, Func<R, K> outerKeyMap, Func<U, K> innerKeyMap, Func<R, U, V> project)
- EitherUnsafeContext <L, R, Ret>
- EitherUnsafeUnitContext <L, R>
- EitherUnsafeExtensions
- Flatten <L, R> (this EitherUnsafe<L, EitherUnsafe<L, R>> ma)
- Plus <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- Subtract <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- Product <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- Divide <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- Apply <L, A, B> (this EitherUnsafe<L, Func<A, B>> fab, EitherUnsafe<L, A> fa)
- Apply <L, A, B> (this Func<A, B> fab, EitherUnsafe<L, A> fa)
- Apply <L, A, B, C> (this EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb)
- Apply <L, A, B, C> (this Func<A, B, C> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb)
- Apply <L, A, B, C> (this EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa)
- Apply <L, A, B, C> (this Func<A, B, C> fabc, EitherUnsafe<L, A> fa)
- Apply <L, A, B, C> (this EitherUnsafe<L, Func<A, Func<B, C>>> fabc, EitherUnsafe<L, A> fa)
- Action <L, A, B> (this EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb)
- Lefts <L, R> (this IEnumerable<EitherUnsafe<L, R>> self)
- Lefts <L, R> (this Seq<EitherUnsafe<L, R>> self)
- Rights <L, R> (this IEnumerable<EitherUnsafe<L, R>> self)
- Rights <L, R> (this Seq<EitherUnsafe<L, R>> self)
- Partition <L, R> (this IEnumerable<EitherUnsafe<L, R>> self)
- Partition <L, R> (this Seq<EitherUnsafe<L, R>> self)
- Sum <NUM, L, R> (this EitherUnsafe<L, R> self)
- Sum <L> (this EitherUnsafe<L, int> self)
- ParMap <L, T1, T2, R> (this EitherUnsafe<L, T1> self, Func<T1, T2, R> func)
- ParMap <L, T1, T2, T3, R> (this EitherUnsafe<L, T1> self, Func<T1, T2, T3, R> func)
- MatchAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, R2> Right, Func<L, R2> Left)
- MapAsync <L, R, R2> (this EitherUnsafe<L, R> self, Func<R, Task<R2>> map)
- MapAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, Task<R2>> map)
- MapAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, R2> map)
- MapAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, R2> map)
- MapAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, Task<R2>> map)
- BindAsync <L, R, R2> (this EitherUnsafe<L, R> self, Func<R, Task<EitherUnsafe<L, R2>>> bind)
- BindAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, Task<EitherUnsafe<L, R2>>> bind)
- BindAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, EitherUnsafe<L, R2>> bind)
- BindAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, EitherUnsafe<L, R2>> bind)
- BindAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, Task<EitherUnsafe<L, R2>>> bind)
- IterAsync <L, R> (this Task<EitherUnsafe<L, R>> self, Action<R> action)
- IterAsync <L, R> (this EitherUnsafe<L, Task<R>> self, Action<R> action)
- CountAsync <L, R> (this Task<EitherUnsafe<L, R>> self)
- SumAsync <L> (this Task<EitherUnsafe<L, int>> self)
- SumAsync <L> (this EitherUnsafe<L, Task<int>> self)
- FoldAsync <L, R, S> (this Task<EitherUnsafe<L, R>> self, S state, Func<S, R, S> folder)
- FoldAsync <L, R, S> (this EitherUnsafe<L, Task<R>> self, S state, Func<S, R, S> folder)
- ForAllAsync <L, R> (this Task<EitherUnsafe<L, R>> self, Func<R, bool> pred)
- ForAllAsync <L, R> (this EitherUnsafe<L, Task<R>> self, Func<R, bool> pred)
- ExistsAsync <L, R> (this Task<EitherUnsafe<L, R>> self, Func<R, bool> pred)
- ExistsAsync <L, R> (this EitherUnsafe<L, Task<R>> self, Func<R, bool> pred)
- ToEff <R> (this EitherUnsafe<Error, R> ma)
- ToAff <R> (this EitherUnsafe<Error, R> ma)
- ToEff <R> (this EitherUnsafe<Exception, R> ma)
- ToAff <R> (this EitherUnsafe<Exception, R> ma)
- ToEff <R> (this EitherUnsafe<string, R> ma)
- ToAff <R> (this EitherUnsafe<string, R> ma)
- EitherUnsafeGuardExtensions
- ToEitherUnsafe <L> (this Guard<L> ma)
- SelectMany <L, B> (this Guard<L> ma, Func<Unit, EitherUnsafe<L, B>> f)
- SelectMany <L, B, C> (this Guard<L> ma, Func<Unit, EitherUnsafe<L, B>> bind, Func<Unit, B, C> project)
- SelectMany <L, A> (this EitherUnsafe<L, A> ma, Func<A, Guard<L>> f)
- SelectMany <L, A, C> (this EitherUnsafe<L, A> ma, Func<A, Guard<L>> bind, Func<A, Unit, C> project)
- Prelude
- flatten <L, R> (EitherUnsafe<L, EitherUnsafe<L, R>> ma)
- plus <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- subtract <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- product <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- divide <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y)
- apply <L, A, B> (EitherUnsafe<L, Func<A, B>> fab, EitherUnsafe<L, A> fa)
- apply <L, A, B> (Func<A, B> fab, EitherUnsafe<L, A> fa)
- apply <L, A, B, C> (EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb)
- apply <L, A, B, C> (Func<A, B, C> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb)
- apply <L, A, B, C> (EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa)
- apply <L, A, B, C> (Func<A, B, C> fabc, EitherUnsafe<L, A> fa)
- apply <L, A, B, C> (EitherUnsafe<L, Func<A, Func<B, C>>> fabc, EitherUnsafe<L, A> fa)
- apply <L, A, B, C> (Func<A, Func<B, C>> fabc, EitherUnsafe<L, A> fa)
- action <L, A, B> (EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb)
- isRight <L, R> (EitherUnsafe<L, R> value)
- isLeft <L, R> (EitherUnsafe<L, R> value)
- RightUnsafe <L, R> (R value)
- RightUnsafe <R> (R value)
- LeftUnsafe <L, R> (L value)
- LeftUnsafe <L> (L value)
- ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, Func<R> Left)
- ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, Func<L, R> leftMap)
- ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, R rightValue)
- ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, Action<L> Left)
- ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, Action<R> Right)
- ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, L leftValue)
- ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, Func<L> Left)
- ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, Func<R, L> leftMap)
- matchUnsafe <L, R, Ret> (EitherUnsafe<L, R> either, Func<R, Ret> Right, Func<L, Ret> Left)
- matchUnsafe <L, R> (EitherUnsafe<L, R> either, Action<R> Right, Action<L> Left)
- fold <S, L, R> (EitherUnsafe<L, R> either, S state, Func<S, R, S> folder)
- bifold <L, R, S> (EitherUnsafe<L, R> either, S state, Func<S, R, S> Right, Func<S, L, S> Left)
- forall <L, R> (EitherUnsafe<L, R> either, Func<R, bool> pred)
- biforall <L, R> (EitherUnsafe<L, R> either, Func<R, bool> Right, Func<L, bool> Left)
- count <L, R> (EitherUnsafe<L, R> either)
- exists <L, R> (EitherUnsafe<L, R> either, Func<R, bool> pred)
- biexists <L, R> (EitherUnsafe<L, R> either, Func<R, bool> Right, Func<L, bool> Left)
- map <L, R, Ret> (EitherUnsafe<L, R> either, Func<R, Ret> mapper)
- bimap <L, R, LRet, RRet> (EitherUnsafe<L, R> either, Func<R, RRet> Right, Func<L, LRet> Left)
- parmap <L, T1, T2, R> (EitherUnsafe<L, T1> either, Func<T1, T2, R> func)
- parmap <L, T1, T2, T3, R> (EitherUnsafe<L, T1> either, Func<T1, T2, T3, R> func)
- filter <L, R> (EitherUnsafe<L, R> either, Func<R, bool> pred)
- bind <L, R, Ret> (EitherUnsafe<L, R> either, Func<R, EitherUnsafe<L, Ret>> binder)
- Match <L, R, Ret> (this IEnumerable<EitherUnsafe<L, R>> list, Func<R, Ret> Right, Func<L, Ret> Left )
- match <L, R, Ret> (IEnumerable<EitherUnsafe<L, R>> list, Func<R, Ret> Right, Func<L, Ret> Left )
- rightToList <L, R> (EitherUnsafe<L, R> either)
- rightToArray <L, R> (EitherUnsafe<L, R> either)
- leftToList <L, R> (EitherUnsafe<L, R> either)
- leftToArray <L, R> (EitherUnsafe<L, R> either)
- toQuery <L, R> (EitherUnsafe<L, R> either)
- rightToQuery <L, R> (EitherUnsafe<L, R> either)
- leftToQuery <L, R> (EitherUnsafe<L, R> either)
- lefts <L, R> (IEnumerable<EitherUnsafe<L, R>> self)
- lefts <L, R> (Seq<EitherUnsafe<L, R>> self)
- rights <L, R> (IEnumerable<EitherUnsafe<L, R>> self)
- rights <L, R> (Seq<EitherUnsafe<L, R>> self)
- partition <L, R> (IEnumerable<EitherUnsafe<L, R>> self)
- partition <L, R> (Seq<EitherUnsafe<L, R>> self)
- IEnumerableEitherUnsafeTransExt
- BiForAllT <L, R> (this IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left)
- BiFoldT <L, R, S> (this IEnumerable<EitherUnsafe<L, R>> self, S state, Func<S, R, S> Right, Func<S, L, S> Left)
- BiExistsT <L, R> (this IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left)
- MapLeftT <L, R, Ret> (this IEnumerable<EitherUnsafe<L, R>> self, Func<L, Ret> mapper)
- BiMapT <L, R, LRet, RRet> (this IEnumerable<EitherUnsafe<L, R>> self, Func<R, RRet> Right, Func<L, LRet> Left)
- Prelude
- biforallT <L, R> (IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left)
- bifoldT <L, R, S> (IEnumerable<EitherUnsafe<L, R>> self, S state, Func<S, R, S> Right, Func<S, L, S> Left)
- biexistsT <L, R> (IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left)
- mapLeftT <L, R, Ret> (IEnumerable<EitherUnsafe<L, R>> self, Func<L, Ret> mapper)
- bimapT <L, R, LRet, RRet> (IEnumerable<EitherUnsafe<L, R>> self, Func<R, RRet> Right, Func<L, LRet> Left)
struct EitherUnsafe <L, R> Source #
Either L R Holds one of two values 'Left' or 'Right'. Usually 'Left' is considered 'wrong' or 'in error', and 'Right' is, well, right. So when the Either is in a Left state, it cancels computations like bind or map, etc. So you can see Left as an 'early out, with a message'. Unlike Option that has None as its alternative value (i.e. it has an 'early out, but no message').
NOTE: If you use Filter or Where (or 'where' in a LINQ expression) with Either, then the Either will be put into a 'Bottom' state if the predicate returns false. When it's in this state it is neither Right nor Left. And any usage could trigger a BottomException. So be aware of the issue of filtering Either.
Also note, when the Either is in a Bottom state, some operations on it will continue to give valid results or return another Either in the Bottom state and not throw. This is so a filtered Either doesn't needlessly break expressions.
type | L | Left |
type | R | Right |
field EitherUnsafe<L, R> Bottom = new EitherUnsafe<L, R>() Source #
property bool IsBottom Source #
Is the EitherUnsafe in a Bottom state? When the EitherUnsafe is filtered, both Right and Left are meaningless.
If you use Filter or Where (or 'where' in a LINQ expression) with EitherUnsafe, then the EitherUnsafe will be put into a 'Bottom' state if the predicate returns false. When it's in this state it is neither Right nor Left. And any usage could trigger a BottomException. So be aware of the issue of filtering Either.
Also note, when the EitherUnsafe is in a Bottom state, some operations on it will continue to give valid results or return another EitherUnsafe in the Bottom state and not throw. This is so a filtered EitherUnsafe doesn't needlessly break expressions.
constructor EitherUnsafe (IEnumerable<EitherData<L, R>> either) Source #
Ctor that facilitates serialisation
param | option | None or Some A. |
method void GetObjectData (SerializationInfo info, StreamingContext context) Source #
method IEnumerator<EitherData<L, R>> GetEnumerator () Source #
method Ret MatchUnsafe <Ret> (Func<R, Ret> Right, Func<L, Ret> Left, Func<Ret> Bottom = null) Source #
Invokes the Right or Left function depending on the state of the EitherUnsafe
type | Ret | Return type |
param | Right | Function to invoke if in a Right state |
param | Left | Function to invoke if in a Left state |
returns | The return value of the invoked function |
method Unit MatchUnsafe (Action<R> Right, Action<L> Left, Action Bottom = null) Source #
Invokes the Right or Left action depending on the state of the EitherUnsafe
param | Right | Action to invoke if in a Right state |
param | Left | Action to invoke if in a Left state |
returns | Unit |
method R IfLeftUnsafe (Func<R> Left) Source #
Executes the Left function if the EitherUnsafe is in a Left state. Returns the Right value if the EitherUnsafe is in a Right state.
param | Left | Function to generate a Right value if in the Left state |
returns | Returns an unwrapped Right value |
method R IfLeftUnsafe (Func<L, R> leftMap) Source #
Executes the leftMap function if the EitherUnsafe is in a Left state. Returns the Right value if the EitherUnsafe is in a Right state.
param | leftMap | Function to generate a Right value if in the Left state |
returns | Returns an unwrapped Right value |
method R IfLeftUnsafe (R rightValue) Source #
Returns the rightValue if the EitherUnsafe is in a Left state. Returns the Right value if the EitherUnsafe is in a Right state.
param | rightValue | Value to return if in the Left state |
returns | Returns an unwrapped Right value |
method Unit IfLeftUnsafe (Action<L> Left) Source #
Executes the Left action if the EitherUnsafe is in a Left state.
param | Left | Function to generate a Right value if in the Left state |
returns | Returns an unwrapped Right value |
method Unit IfRightUnsafe (Action<R> Right) Source #
Invokes the Right action if the EitherUnsafe is in a Right state, otherwise does nothing
param | Right | Action to invoke |
returns | Unit |
method L IfRightUnsafe (L leftValue) Source #
Returns the leftValue if the EitherUnsafe is in a Right state. Returns the Left value if the EitherUnsafe is in a Left state.
param | leftValue | Value to return if in the Left state |
returns | Returns an unwrapped Left value |
method L IfRightUnsafe (Func<L> Right) Source #
Returns the result of Right() if the EitherUnsafe is in a Right state. Returns the Left value if the EitherUnsafe is in a Left state.
param | Right | Function to generate a Left value if in the Right state |
returns | Returns an unwrapped Left value |
method L IfRightUnsafe (Func<R, L> rightMap) Source #
Returns the result of rightMap if the EitherUnsafe is in a Right state. Returns the Left value if the EitherUnsafe is in a Left state.
param | rightMap | Function to generate a Left value if in the Right state |
returns | Returns an unwrapped Left value |
method EitherUnsafeUnitContext<L, R> Right (Action<R> right) Source #
Match Right and return a context. You must follow this with .Left(...) to complete the match
param | right | Action to invoke if the EitherUnsafe is in a Right state |
returns | Context that must have Left() called upon it. |
method EitherUnsafeContext<L, R, Ret> Right <Ret> (Func<R, Ret> right) Source #
Match Right and return a context. You must follow this with .Left(...) to complete the match
param | right | Action to invoke if the EitherUnsafe is in a Right state |
returns | Context that must have Left() called upon it. |
method string ToString () Source #
Return a string representation of the EitherUnsafe
returns | String representation of the EitherUnsafe |
method int GetHashCode () Source #
Returns a hash code of the wrapped value of the EitherUnsafe
returns | Hash code |
method bool Equals (object obj) Source #
Equality check
param | obj | Object to test for equality |
returns | True if equal |
method Lst<R> ToList () Source #
Project the EitherUnsafe into a Lst R
returns | If the EitherUnsafe is in a Right state, a Lst of R with one item. A zero length Lst R otherwise |
method Arr<R> ToArray () Source #
Project the EitherUnsafe into an ImmutableArray R
returns | If the EitherUnsafe is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise |
method Lst<R> RightToList () Source #
Project the EitherUnsafe into a Lst R
returns | If the EitherUnsafe is in a Right state, a Lst of R with one item. A zero length Lst R otherwise |
method Arr<R> RightToArray () Source #
Project the EitherUnsafe into an ImmutableArray R
returns | If the EitherUnsafe is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise |
method Lst<L> LeftToList () Source #
Project the EitherUnsafe into a Lst R
returns | If the EitherUnsafe is in a Right state, a Lst of R with one item. A zero length Lst R otherwise |
method Arr<L> LeftToArray () Source #
Project the EitherUnsafe into an ImmutableArray R
returns | If the EitherUnsafe is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise |
method Seq<R> RightToSeq () Source #
Convert either to sequence of 0 or 1 right values
method Seq<R> RightAsEnumerable () Source #
Project the EitherUnsafe into a IEnumerable R
returns | If the EitherUnsafe is in a Right state, a IEnumerable of R with one item. A zero length IEnumerable R otherwise |
method Seq<L> LeftAsEnumerable () Source #
Project the EitherUnsafe into a IEnumerable L
returns | If the EitherUnsafe is in a Left state, a IEnumerable of L with one item. A zero length IEnumerable L otherwise |
method Validation<L, R> ToValidation () Source #
method OptionUnsafe<R> ToOption () Source #
Convert the EitherUnsafe to an OptionUnsafe
returns | Some(Right) or None |
method Eff<R> ToEff (Func<L, Common.Error> Left) Source #
Convert to an Eff
param | Left | Map the left value to the Eff Error |
returns | Eff monad |
method Aff<R> ToAff (Func<L, Common.Error> Left) Source #
Convert to an Aff
param | Left | Map the left value to the Eff Error |
returns | Aff monad |
method EitherUnsafe<L, R> ToEither () Source #
Convert the EitherUnsafe to an EitherUnsafeUnsafe
returns | EitherUnsafeUnsafe |
method TResult MatchUntyped <TResult> (Func<object, TResult> Right, Func<object, TResult> Left) Source #
Match the Right and Left values but as objects. This can be useful to avoid reflection.
method Type GetUnderlyingRightType () Source #
Find out the underlying Right type
method Type GetUnderlyingLeftType () Source #
Find out the underlying Left type
method R1 MatchUntyped <R1> (Func<object, R1> Some, Func<R1> None) Source #
method Type GetUnderlyingType () Source #
Counts the EitherUnsafe
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to count |
returns | 1 if the EitherUnsafe is in a Right state, 0 otherwise. |
method EitherUnsafe<R, L> Swap () Source #
Flips the left and right tagged values
returns | Either with the types swapped |
method Unit Iter (Action<R> Right) Source #
Iterate the EitherUnsafe action is invoked if in the Right state
method Unit BiIter (Action<R> Right, Action<L> Left) Source #
Iterate the EitherUnsafe action is invoked if in the Right state
method bool ForAll (Func<R, bool> Right) Source #
Invokes a predicate on the value of the EitherUnsafe if it's in the Right state
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to forall |
param | Right | Predicate |
returns | True if the EitherUnsafe is in a Left state. True if the EitherUnsafe is in a Right state and the predicate returns True. False otherwise. |
method bool BiForAll (Func<R, bool> Right, Func<L, bool> Left) Source #
Invokes a predicate on the value of the EitherUnsafe if it's in the Right state
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to forall |
param | Right | Predicate |
param | Left | Predicate |
returns | True if EitherUnsafe Predicate returns true |
method S Fold <S> (S state, Func<S, R, S> Right) Source #
EitherUnsafe types are like lists of 0 or 1 items, and therefore follow the same rules when folding.
In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:
type | S | Aggregate state type |
param | state | Initial state |
param | Right | Folder function, applied if structure is in a Right state |
returns | The aggregate state |
method S BiFold <S> (S state, Func<S, R, S> Right, Func<S, L, S> Left) Source #
EitherUnsafe types are like lists of 0 or 1 items, and therefore follow the same rules when folding.
In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:
type | S | Aggregate state type |
param | state | Initial state |
param | Right | Folder function, applied if EitherUnsafe is in a Right state |
param | Left | Folder function, applied if EitherUnsafe is in a Left state |
returns | The aggregate state |
method bool Exists (Func<R, bool> pred) Source #
Invokes a predicate on the value of the EitherUnsafe if it's in the Right state
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to check existence of |
param | pred | Predicate |
returns | True if the EitherUnsafe is in a Right state and the predicate returns True. False otherwise. |
method bool BiExists (Func<R, bool> Right, Func<L, bool> Left) Source #
Invokes a predicate on the value of the EitherUnsafe
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to check existence of |
param | Right | Right predicate |
param | Left | Left predicate |
returns | True if the predicate returns True. False otherwise or if the EitherUnsafe is in a bottom state. |
method EitherUnsafe<L, R> Do (Action<R> f) Source #
Impure iteration of the bound values in the structure
returns | Returns the original unmodified structure |
method EitherUnsafe<L, Ret> Map <Ret> (Func<R, Ret> mapper) Source #
Maps the value in the EitherUnsafe if it's in a Right state
type | L | Left |
type | R | Right |
type | Ret | Mapped EitherUnsafe type |
param | self | EitherUnsafe to map |
param | mapper | Map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<Ret, R> MapLeft <Ret> (Func<L, Ret> mapper) Source #
Maps the value in the EitherUnsafe if it's in a Left state
type | L | Left |
type | R | Right |
type | Ret | Mapped EitherUnsafe type |
param | self | EitherUnsafe to map |
param | mapper | Map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<L, Ret> BiMap <Ret> (Func<R, Ret> Right, Func<L, Ret> Left) Source #
Bi-maps the value in the EitherUnsafe into a Right state
type | L | Left |
type | R | Right |
type | LRet | Left return |
type | RRet | Right return |
param | self | EitherUnsafe to map |
param | Right | Right map function |
param | Left | Left map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<L2, R2> BiMap <L2, R2> (Func<R, R2> Right, Func<L, L2> Left) Source #
Bi-maps the value in the EitherUnsafe if it's in a Right state
type | L | Left |
type | R | Right |
type | LRet | Left return |
type | RRet | Right return |
param | self | EitherUnsafe to map |
param | Right | Right map function |
param | Left | Left map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<L, Ret> Bind <Ret> (Func<R, EitherUnsafe<L, Ret>> binder) Source #
Monadic bind
type | L | Left |
type | R | Right |
type | Ret | |
param | self | |
param | binder | |
returns | Bound EitherUnsafe |
method EitherUnsafe<L, B> BiBind <B> (Func<R, EitherUnsafe<L, B>> Right, Func<L, EitherUnsafe<L, B>> Left) Source #
Bi-bind. Allows mapping of both monad states
method EitherUnsafe<B, R> BindLeft <B> (Func<L, EitherUnsafe<B, R>> f) Source #
Bind left. Binds the left path of the monad only
method EitherUnsafe<L, R> Filter (Func<R, bool> pred) Source #
Filter the EitherUnsafe
This may give unpredictable results for a filtered value. The EitherUnsafe won't return true for IsLeft or IsRight. IsBottom is True if the value is filtered and that should be checked for.
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to filter |
param | pred | Predicate function |
returns | If the EitherUnsafe is in the Left state it is returned as-is. If in the Right state the predicate is applied to the Right value. If the predicate returns True the EitherUnsafe is returned as-is. If the predicate returns False the EitherUnsafe is returned in a 'Bottom' state. |
method EitherUnsafe<L, R> Where (Func<R, bool> pred) Source #
Filter the EitherUnsafe
This may give unpredictable results for a filtered value. The EitherUnsafe won't return true for IsLeft or IsRight. IsBottom is True if the value is filtered and that should be checked for.
type | L | Left |
type | R | Right |
param | self | EitherUnsafe to filter |
param | pred | Predicate function |
returns | If the EitherUnsafe is in the Left state it is returned as-is. If in the Right state the predicate is applied to the Right value. If the predicate returns True the EitherUnsafe is returned as-is. If the predicate returns False the EitherUnsafe is returned in a 'Bottom' state. IsLeft will return True, but the value of Left = default(L) |
method EitherUnsafe<L, U> Select <U> (Func<R, U> map) Source #
Maps the value in the EitherUnsafe if it's in a Right state
type | L | Left |
type | TR | Right |
type | UR | Mapped EitherUnsafe type |
param | self | EitherUnsafe to map |
param | map | Map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<L, V> SelectMany <U, V> (Func<R, EitherUnsafe<L, U>> bind, Func<R, U, V> project) Source #
Monadic bind function
returns | Bound EitherUnsafe |
operator < (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs) Source #
Comparison operator
param | lhs | The left hand side of the operation |
param | rhs | The right hand side of the operation |
returns | True if lhs < rhs |
operator <= (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs) Source #
Comparison operator
param | lhs | The left hand side of the operation |
param | rhs | The right hand side of the operation |
returns | True if lhs <= rhs |
operator > (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs) Source #
Comparison operator
param | lhs | The left hand side of the operation |
param | rhs | The right hand side of the operation |
returns | True if lhs > rhs |
operator >= (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs) Source #
Comparison operator
param | lhs | The left hand side of the operation |
param | rhs | The right hand side of the operation |
returns | True if lhs >= rhs |
operator != (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs) Source #
Non-equality operator override
operator | (EitherUnsafe<L, R> lhs, EitherUnsafe<L, R> rhs) Source #
Override of the Or operator to be a Left coalescing operator
struct EitherUnsafeContext <L, R, Ret> Source #
Context for the fluent EitherUnsafe matching
struct EitherUnsafeUnitContext <L, R> Source #
Context for the fluent Either matching
class EitherUnsafeExtensions Source #
Extension methods for Either
method EitherUnsafe<L, R> Flatten <L, R> (this EitherUnsafe<L, EitherUnsafe<L, R>> ma) Source #
Monadic join
method EitherUnsafe<L, R> Plus <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Add the bound values of x and y, uses an Add type-class to provide the add operation for type A. For example x.Add<TInteger,int>(y)
type | NUM | Num of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with y added to x |
method EitherUnsafe<L, R> Subtract <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Find the subtract between the two bound values of x and y, uses a Subtract type-class to provide the subtract operation for type A. For example x.Subtract<TInteger,int>(y)
type | DIFF | Subtract of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with the subtract between x and y |
method EitherUnsafe<L, R> Product <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Find the product between the two bound values of x and y, uses a Product type-class to provide the product operation for type A. For example x.Product<TInteger,int>(y)
type | PROD | Product of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with the product of x and y |
method EitherUnsafe<L, R> Divide <NUM, L, R> (this EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Divide the two bound values of x and y, uses a Divide type-class to provide the divide operation for type A. For example x.Divide<TDouble,double>(y)
type | DIV | Divide of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option x / y |
method EitherUnsafe<L, B> Apply <L, A, B> (this EitherUnsafe<L, Func<A, B>> fab, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method EitherUnsafe<L, B> Apply <L, A, B> (this Func<A, B> fab, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method EitherUnsafe<L, C> Apply <L, A, B, C> (this EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method EitherUnsafe<L, C> Apply <L, A, B, C> (this Func<A, B, C> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method EitherUnsafe<L, Func<B, C>> Apply <L, A, B, C> (this EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, Func<B, C>> Apply <L, A, B, C> (this Func<A, B, C> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, Func<B, C>> Apply <L, A, B, C> (this EitherUnsafe<L, Func<A, Func<B, C>>> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, B> Action <L, A, B> (this EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb) Source #
Evaluate fa, then fb, ignoring the result of fa
param | fa | Applicative to evaluate first |
param | fb | Applicative to evaluate second and then return |
returns | Applicative of type Option |
method IEnumerable<L> Lefts <L, R> (this IEnumerable<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method Seq<L> Lefts <L, R> (this Seq<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method IEnumerable<R> Rights <L, R> (this IEnumerable<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method Seq<R> Rights <L, R> (this Seq<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method (IEnumerable<L> Lefts, IEnumerable<R> Rights) Partition <L, R> (this IEnumerable<EitherUnsafe<L, R>> self) Source #
Partitions a list of 'Either' into two lists. All the 'Left' elements are extracted, in order, to the first component of the output. Similarly the 'Right' elements are extracted to the second component of the output.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | A tuple containing the an enumerable of L and an enumerable of R |
method (Seq<L> Lefts, Seq<R> Rights) Partition <L, R> (this Seq<EitherUnsafe<L, R>> self) Source #
Partitions a list of 'Either' into two lists. All the 'Left' elements are extracted, in order, to the first component of the output. Similarly the 'Right' elements are extracted to the second component of the output.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | A tuple containing the an enumerable of L and an enumerable of R |
method R Sum <NUM, L, R> (this EitherUnsafe<L, R> self) Source #
Sum of the Either
type | L | Left |
param | self | Either to count |
returns | 0 if Left, or value of Right |
method int Sum <L> (this EitherUnsafe<L, int> self) Source #
Sum of the Either
type | L | Left |
param | self | Either to count |
returns | 0 if Left, or value of Right |
method EitherUnsafe<L, Func<T2, R>> ParMap <L, T1, T2, R> (this EitherUnsafe<L, T1> self, Func<T1, T2, R> func) Source #
Partial application map
method EitherUnsafe<L, Func<T2, Func<T3, R>>> ParMap <L, T1, T2, T3, R> (this EitherUnsafe<L, T1> self, Func<T1, T2, T3, R> func) Source #
Partial application map
method Task<R2> MatchAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, R2> Right, Func<L, R2> Left) Source #
Match the two states of the Either and return a promise of a non-null R2.
method Task<EitherUnsafe<L, R2>> MapAsync <L, R, R2> (this EitherUnsafe<L, R> self, Func<R, Task<R2>> map) Source #
method Task<EitherUnsafe<L, R2>> MapAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, Task<R2>> map) Source #
method Task<EitherUnsafe<L, R2>> MapAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, R2> map) Source #
method Task<EitherUnsafe<L, R2>> MapAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, R2> map) Source #
method Task<EitherUnsafe<L, R2>> MapAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, Task<R2>> map) Source #
method Task<EitherUnsafe<L, R2>> BindAsync <L, R, R2> (this EitherUnsafe<L, R> self, Func<R, Task<EitherUnsafe<L, R2>>> bind) Source #
method Task<EitherUnsafe<L, R2>> BindAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, Task<EitherUnsafe<L, R2>>> bind) Source #
method Task<EitherUnsafe<L, R2>> BindAsync <L, R, R2> (this Task<EitherUnsafe<L, R>> self, Func<R, EitherUnsafe<L, R2>> bind) Source #
method Task<EitherUnsafe<L, R2>> BindAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, EitherUnsafe<L, R2>> bind) Source #
method Task<EitherUnsafe<L, R2>> BindAsync <L, R, R2> (this EitherUnsafe<L, Task<R>> self, Func<R, Task<EitherUnsafe<L, R2>>> bind) Source #
method Task<int> CountAsync <L, R> (this Task<EitherUnsafe<L, R>> self) Source #
method Task<S> FoldAsync <L, R, S> (this Task<EitherUnsafe<L, R>> self, S state, Func<S, R, S> folder) Source #
method Task<S> FoldAsync <L, R, S> (this EitherUnsafe<L, Task<R>> self, S state, Func<S, R, S> folder) Source #
method Task<bool> ForAllAsync <L, R> (this Task<EitherUnsafe<L, R>> self, Func<R, bool> pred) Source #
method Task<bool> ForAllAsync <L, R> (this EitherUnsafe<L, Task<R>> self, Func<R, bool> pred) Source #
method Task<bool> ExistsAsync <L, R> (this Task<EitherUnsafe<L, R>> self, Func<R, bool> pred) Source #
method Task<bool> ExistsAsync <L, R> (this EitherUnsafe<L, Task<R>> self, Func<R, bool> pred) Source #
method Eff<R> ToEff <R> (this EitherUnsafe<Error, R> ma) Source #
Convert to an Eff
returns | Eff monad |
method Aff<R> ToAff <R> (this EitherUnsafe<Error, R> ma) Source #
Convert to an Aff
returns | Aff monad |
method Eff<R> ToEff <R> (this EitherUnsafe<Exception, R> ma) Source #
Convert to an Eff
returns | Eff monad |
method Aff<R> ToAff <R> (this EitherUnsafe<Exception, R> ma) Source #
Convert to an Aff
returns | Aff monad |
class EitherUnsafeGuardExtensions Source #
method EitherUnsafe<L, Unit> ToEitherUnsafe <L> (this Guard<L> ma) Source #
method EitherUnsafe<L, B> SelectMany <L, B> (this Guard<L> ma, Func<Unit, EitherUnsafe<L, B>> f) Source #
method EitherUnsafe<L, C> SelectMany <L, B, C> (this Guard<L> ma, Func<Unit, EitherUnsafe<L, B>> bind, Func<Unit, B, C> project) Source #
method EitherUnsafe<L, Unit> SelectMany <L, A> (this EitherUnsafe<L, A> ma, Func<A, Guard<L>> f) Source #
method EitherUnsafe<L, C> SelectMany <L, A, C> (this EitherUnsafe<L, A> ma, Func<A, Guard<L>> bind, Func<A, Unit, C> project) Source #
method EitherUnsafe<L, R> flatten <L, R> (EitherUnsafe<L, EitherUnsafe<L, R>> ma) Source #
Monadic join
method EitherUnsafe<L, R> plus <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Add the bound values of x and y, uses an Add type-class to provide the add operation for type A. For example x.Add<TInteger,int>(y)
type | NUM | Num of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with y added to x |
method EitherUnsafe<L, R> subtract <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Find the subtract between the two bound values of x and y, uses a Subtract type-class to provide the subtract operation for type A. For example x.Subtract<TInteger,int>(y)
type | DIFF | Subtract of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with the subtract between x and y |
method EitherUnsafe<L, R> product <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Find the product between the two bound values of x and y, uses a Product type-class to provide the product operation for type A. For example x.Product<TInteger,int>(y)
type | PROD | Product of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with the product of x and y |
method EitherUnsafe<L, R> divide <NUM, L, R> (EitherUnsafe<L, R> x, EitherUnsafe<L, R> y) Source #
Divide the two bound values of x and y, uses a Divide type-class to provide the divide operation for type A. For example x.Divide<TDouble,double>(y)
type | DIV | Divide of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option x / y |
method EitherUnsafe<L, B> apply <L, A, B> (EitherUnsafe<L, Func<A, B>> fab, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method EitherUnsafe<L, B> apply <L, A, B> (Func<A, B> fab, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method EitherUnsafe<L, C> apply <L, A, B, C> (EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method EitherUnsafe<L, C> apply <L, A, B, C> (Func<A, B, C> fabc, EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method EitherUnsafe<L, Func<B, C>> apply <L, A, B, C> (EitherUnsafe<L, Func<A, B, C>> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, Func<B, C>> apply <L, A, B, C> (Func<A, B, C> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, Func<B, C>> apply <L, A, B, C> (EitherUnsafe<L, Func<A, Func<B, C>>> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, Func<B, C>> apply <L, A, B, C> (Func<A, Func<B, C>> fabc, EitherUnsafe<L, A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method EitherUnsafe<L, B> action <L, A, B> (EitherUnsafe<L, A> fa, EitherUnsafe<L, B> fb) Source #
Evaluate fa, then fb, ignoring the result of fa
param | fa | Applicative to evaluate first |
param | fb | Applicative to evaluate second and then return |
returns | Applicative of type Option |
method bool isRight <L, R> (EitherUnsafe<L, R> value) Source #
Returns the state of the Either provided
type | L | Left |
type | R | Right |
param | value | Either to check |
returns | True if the Either is in a Right state |
method bool isLeft <L, R> (EitherUnsafe<L, R> value) Source #
Returns the state of the Either provided
type | L | Left |
type | R | Right |
param | value | Either to check |
returns | True if the Either is in a Left state |
method EitherUnsafe<L, R> RightUnsafe <L, R> (R value) Source #
Either constructor Constructs an Either in a Right state
type | L | Left |
type | R | Right |
param | value | Right value |
returns | A new Either instance |
method EitherRight<R> RightUnsafe <R> (R value) Source #
Constructs an EitherRight which can be implicitly cast to an EitherUnsafe<_, R>
type | R | Right |
param | value | Right value |
returns | A new EitherRight instance |
method EitherUnsafe<L, R> LeftUnsafe <L, R> (L value) Source #
Either constructor Constructs an Either in a Left state
type | L | Left |
type | R | Right |
param | value | Left value |
returns | A new Either instance |
method EitherLeft<L> LeftUnsafe <L> (L value) Source #
Constructs an EitherLeft which can be implicitly cast to an EitherUnsafe<L, _>
type | L | Left |
param | value | Right value |
returns | A new EitherLeft instance |
method R ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, Func<R> Left) Source #
Executes the Left function if the Either is in a Left state. Returns the Right value if the Either is in a Right state.
param | Left | Function to generate a Right value if in the Left state |
returns | Returns an unwrapped Right value |
method R ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, Func<L, R> leftMap) Source #
Executes the leftMap function if the Either is in a Left state. Returns the Right value if the Either is in a Right state.
param | leftMap | Function to generate a Right value if in the Left state |
returns | Returns an unwrapped Right value |
method R ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, R rightValue) Source #
Returns the rightValue if the Either is in a Left state. Returns the Right value if the Either is in a Right state.
param | rightValue | Value to return if in the Left state |
returns | Returns an unwrapped Right value |
method Unit ifLeftUnsafe <L, R> (EitherUnsafe<L, R> either, Action<L> Left) Source #
Executes the Left action if the Either is in a Left state.
param | Left | Function to generate a Right value if in the Left state |
returns | Returns an unwrapped Right value |
method Unit ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, Action<R> Right) Source #
Invokes the Right action if the Either is in a Right state, otherwise does nothing
param | Right | Action to invoke |
returns | Unit |
method L ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, L leftValue) Source #
Returns the leftValue if the Either is in a Right state. Returns the Left value if the Either is in a Left state.
param | leftValue | Value to return if in the Left state |
returns | Returns an unwrapped Left value |
method L ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, Func<L> Left) Source #
Returns the result of Left() if the Either is in a Right state. Returns the Left value if the Either is in a Left state.
param | Left | Function to generate a Left value if in the Right state |
returns | Returns an unwrapped Left value |
method L ifRightUnsafe <L, R> (EitherUnsafe<L, R> either, Func<R, L> leftMap) Source #
Returns the result of leftMap if the Either is in a Right state. Returns the Left value if the Either is in a Left state.
param | leftMap | Function to generate a Left value if in the Right state |
returns | Returns an unwrapped Left value |
method Ret matchUnsafe <L, R, Ret> (EitherUnsafe<L, R> either, Func<R, Ret> Right, Func<L, Ret> Left) Source #
Invokes the Right or Left function depending on the state of the Either provided
type | L | Left |
type | R | Right |
type | Ret | Return type |
param | either | Either to match |
param | Right | Function to invoke if in a Right state |
param | Left | Function to invoke if in a Left state |
returns | The return value of the invoked function |
method Unit matchUnsafe <L, R> (EitherUnsafe<L, R> either, Action<R> Right, Action<L> Left) Source #
Invokes the Right or Left action depending on the state of the Either provided
type | L | Left |
type | R | Right |
param | either | Either to match |
param | Right | Action to invoke if in a Right state |
param | Left | Action to invoke if in a Left state |
returns | Unit |
method S fold <S, L, R> (EitherUnsafe<L, R> either, S state, Func<S, R, S> folder) Source #
Either types are like lists of 0 or 1 items, and therefore follow the same rules when folding.
In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if structure is in a Right state |
returns | The aggregate state |
method S bifold <L, R, S> (EitherUnsafe<L, R> either, S state, Func<S, R, S> Right, Func<S, L, S> Left) Source #
Either types are like lists of 0 or 1 items, and therefore follow the same rules when folding.
In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:
type | S | Aggregate state type |
param | state | Initial state |
param | Right | Folder function, applied if Either is in a Right state |
param | Left | Folder function, applied if Either is in a Left state |
returns | The aggregate state |
method bool forall <L, R> (EitherUnsafe<L, R> either, Func<R, bool> pred) Source #
Invokes a predicate on the value of the Either if it's in the Right state
type | L | Left |
type | R | Right |
param | either | Either to forall |
param | pred | Predicate |
returns | True if the Either is in a Left state. True if the Either is in a Right state and the predicate returns True. False otherwise. |
method bool biforall <L, R> (EitherUnsafe<L, R> either, Func<R, bool> Right, Func<L, bool> Left) Source #
Invokes a predicate on the value of the Either if it's in the Right state
type | L | Left |
type | R | Right |
param | self | Either to forall |
param | Right | Right predicate |
param | Left | Left predicate |
returns | True if the predicate returns True. True if the Either is in a bottom state. |
method int count <L, R> (EitherUnsafe<L, R> either) Source #
Counts the Either
type | L | Left |
type | R | Right |
param | either | Either to count |
returns | 1 if the Either is in a Right state, 0 otherwise. |
method bool exists <L, R> (EitherUnsafe<L, R> either, Func<R, bool> pred) Source #
Invokes a predicate on the value of the Either if it's in the Right state
type | L | Left |
type | R | Right |
param | either | Either to check existence of |
param | pred | Predicate |
returns | True if the Either is in a Right state and the predicate returns True. False otherwise. |
method bool biexists <L, R> (EitherUnsafe<L, R> either, Func<R, bool> Right, Func<L, bool> Left) Source #
Invokes a predicate on the value of the Either
type | L | Left |
type | R | Right |
param | self | Either to check existence of |
param | Right | Right predicate |
param | Left | Left predicate |
returns | True if the predicate returns True. False otherwise or if the Either is in a bottom state. |
method EitherUnsafe<L, Ret> map <L, R, Ret> (EitherUnsafe<L, R> either, Func<R, Ret> mapper) Source #
Maps the value in the Either if it's in a Right state
type | L | Left |
type | R | Right |
type | Ret | Mapped Either type |
param | either | Either to map |
param | mapper | Map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<LRet, RRet> bimap <L, R, LRet, RRet> (EitherUnsafe<L, R> either, Func<R, RRet> Right, Func<L, LRet> Left) Source #
Bi-maps the value in the Either if it's in a Right state
type | L | Left |
type | R | Right |
type | LRet | Left return |
type | RRet | Right return |
param | self | Either to map |
param | Right | Right map function |
param | Left | Left map function |
returns | Mapped EitherUnsafe |
method EitherUnsafe<L, Func<T2, R>> parmap <L, T1, T2, R> (EitherUnsafe<L, T1> either, Func<T1, T2, R> func) Source #
Partial application map
method EitherUnsafe<L, Func<T2, Func<T3, R>>> parmap <L, T1, T2, T3, R> (EitherUnsafe<L, T1> either, Func<T1, T2, T3, R> func) Source #
Partial application map
method EitherUnsafe<L, R> filter <L, R> (EitherUnsafe<L, R> either, Func<R, bool> pred) Source #
Filter the Either
This may give unpredictable results for a filtered value. The Either won't return true for IsLeft or IsRight. IsBottom is True if the value is filtered and that should be checked for.
type | L | Left |
type | R | Right |
param | self | Either to filter |
param | pred | Predicate function |
returns | If the Either is in the Left state it is returned as-is. If in the Right state the predicate is applied to the Right value. If the predicate returns True the Either is returned as-is. If the predicate returns False the Either is returned in a 'Bottom' state. |
method EitherUnsafe<L, Ret> bind <L, R, Ret> (EitherUnsafe<L, R> either, Func<R, EitherUnsafe<L, Ret>> binder) Source #
Monadic bind function https://en.wikipedia.org/wiki/Monad_(functional_programming)
type | L | Left |
type | R | Right |
type | Ret | |
param | either | |
param | binder | |
returns | Bound EitherUnsafe |
method IEnumerable<Ret> Match <L, R, Ret> (this IEnumerable<EitherUnsafe<L, R>> list, Func<R, Ret> Right, Func<L, Ret> Left ) Source #
Match over a sequence of Eithers
type | L | Left |
type | R | Right |
type | Ret | Mapped type |
param | list | Sequence to match over |
param | Right | Right match function |
param | Left | Left match function |
returns | Sequence of mapped values |
method IEnumerable<Ret> match <L, R, Ret> (IEnumerable<EitherUnsafe<L, R>> list, Func<R, Ret> Right, Func<L, Ret> Left ) Source #
Match over a sequence of Eithers
type | L | Left |
type | R | Right |
type | Ret | Mapped type |
param | list | Sequence to match over |
param | Right | Right match function |
param | Left | Left match function |
returns | Sequence of mapped values |
method Lst<R> rightToList <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into a Lst R
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Right state, a Lst of R with one item. A zero length Lst R otherwise |
method Arr<R> rightToArray <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into an ImmutableArray R
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise |
method Lst<L> leftToList <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into a Lst L
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Left state, a Lst of L with one item. A zero length Lst L otherwise |
method Arr<L> leftToArray <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into an array of L
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Right state, an array of L with one item. A zero length array of L otherwise |
method IQueryable<R> toQuery <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into an IQueryable of R
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Right state, an IQueryable of R with one item. A zero length IQueryable R otherwise |
method IQueryable<R> rightToQuery <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into an IQueryable of R
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Right state, an IQueryable of R with one item. A zero length IQueryable R otherwise |
method IQueryable<L> leftToQuery <L, R> (EitherUnsafe<L, R> either) Source #
Project the Either into an IQueryable of L
type | L | Left |
type | R | Right |
param | either | Either to project |
returns | If the Either is in a Left state, an IQueryable of L with one item. A zero length IQueryable L otherwise |
method IEnumerable<L> lefts <L, R> (IEnumerable<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method Seq<L> lefts <L, R> (Seq<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method IEnumerable<R> rights <L, R> (IEnumerable<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method Seq<R> rights <L, R> (Seq<EitherUnsafe<L, R>> self) Source #
Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | An enumerable of L |
method (IEnumerable<L> Lefts, IEnumerable<R> Rights) partition <L, R> (IEnumerable<EitherUnsafe<L, R>> self) Source #
Partitions a list of 'Either' into two lists. All the 'Left' elements are extracted, in order, to the first component of the output. Similarly the 'Right' elements are extracted to the second component of the output.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | A tuple containing the an enumerable of L and an enumerable of R |
method (Seq<L> Lefts, Seq<R> Rights) partition <L, R> (Seq<EitherUnsafe<L, R>> self) Source #
Partitions a list of 'Either' into two lists. All the 'Left' elements are extracted, in order, to the first component of the output. Similarly the 'Right' elements are extracted to the second component of the output.
type | L | Left |
type | R | Right |
param | self | Either list |
returns | A tuple containing the an enumerable of L and an enumerable of R |
class IEnumerableEitherUnsafeTransExt Source #
method bool BiForAllT <L, R> (this IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left) Source #
method S BiFoldT <L, R, S> (this IEnumerable<EitherUnsafe<L, R>> self, S state, Func<S, R, S> Right, Func<S, L, S> Left) Source #
method bool BiExistsT <L, R> (this IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left) Source #
method bool biforallT <L, R> (IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left) Source #
method S bifoldT <L, R, S> (IEnumerable<EitherUnsafe<L, R>> self, S state, Func<S, R, S> Right, Func<S, L, S> Left) Source #
method bool biexistsT <L, R> (IEnumerable<EitherUnsafe<L, R>> self, Func<R, bool> Right, Func<L, bool> Left) Source #