LanguageExt.Core

LanguageExt.Core Type Classes ChoiceUnsafe

Contents

interface ChoiceUnsafe <CH, L, R> Source #

class ChoiceUnsafe Source #

Methods

method R matchUntypedUnsafe <CHOICE, CH, A, B, R> (CH ma, Func<object, R> Left, Func<object, R> Right, Func<R> Bottom = null) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface

Parameters

type R

The return type

param Some

Operation to perform if the option is in a Some state

param None

Operation to perform if the option is in a None state

returns

The result of the match operation

method Arr<B> toArray <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Convert the Option to an enumerable of zero or one items

Parameters

param ma

Option

returns

An enumerable of zero or one items

method Lst<B> toList <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Convert the Option to an immutable list of zero or one items

Parameters

param ma

Option

returns

An immutable list of zero or one items

method IEnumerable<B> toSeq <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Convert the Option to an enumerable sequence of zero or one items

Parameters

type A

Bound value type

param ma

Option

returns

An enumerable sequence of zero or one items

method EitherUnsafe<A, B> toEitherUnsafe <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Convert the structure to an EitherUnsafe

method OptionUnsafe<B> toOptionUnsafe <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Convert the structure to a OptionUnsafe

method B ifLeftUnsafe <CHOICE, CH, A, B> (CH ma, Func<B> Left) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

method B ifLeftUnsafe <CHOICE, CH, A, B> (CH ma, Func<A, B> leftMap) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

method B ifLeftUnsafe <CHOICE, CH, A, B> (CH ma, B rightValue) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

method Unit ifLeftUnsafe <CHOICE, CH, A, B> (CH ma, Action<A> Left) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

method Unit ifRightUnsafe <CHOICE, CH, A, B> (CH ma, Action<B> Right) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

method A ifRightUnsafe <CHOICE, CH, A, B> (CH ma, A leftValue) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Returns the leftValue if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param leftValue

Value to return if in the Left state

returns

Returns an unwrapped Left value

method A ifRightUnsafe <CHOICE, CH, A, B> (CH ma, Func<A> Right) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Returns the result of Right() if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param Right

Function to generate a Left value if in the Right state

returns

Returns an unwrapped Left value

method A ifRightUnsafe <CHOICE, CH, A, B> (CH ma, Func<B, A> rightMap) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Returns the result of rightMap if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param rightMap

Function to generate a Left value if in the Right state

returns

Returns an unwrapped Left value

method Lst<B> rightToList <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Project the Either into a Lst R

Parameters

returns

If the Either is in a Right state, a Lst of R with one item. A zero length Lst R otherwise

method Arr<B> rightToArray <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Project the Either into an ImmutableArray R

Parameters

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<A> leftToList <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Project the Either into a Lst R

Parameters

returns

If the Either is in a Right state, a Lst of R with one item. A zero length Lst R otherwise

method Arr<A> leftToArray <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Project the Either into an ImmutableArray R

Parameters

returns

If the Either is in a Right state, a ImmutableArray of R with one item. A zero length ImmutableArray of R otherwise

method Seq<B> rightAsEnumerable <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Project the Either into a IEnumerable R

Parameters

returns

If the Either is in a Right state, a IEnumerable of R with one item. A zero length IEnumerable R otherwise

method Seq<A> leftAsEnumerable <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Project the Either into a IEnumerable L

Parameters

returns

If the Either is in a Left state, a IEnumerable of L with one item. A zero length IEnumerable L otherwise

method int hashCode <CHOICE, CH, A, B> (CH ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

method IEnumerable<A> lefts <CHOICE, CH, A, B> (IEnumerable<CH> ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Either list

returns

An enumerable of L

method Seq<A> lefts <CHOICE, CH, A, B> (Seq<CH> ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Extracts from a list of 'Either' all the 'Left' elements. All the 'Left' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Either list

returns

An enumerable of L

method IEnumerable<B> rights <CHOICE, CH, A, B> (IEnumerable<CH> ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

An enumerable of L

method Seq<B> rights <CHOICE, CH, A, B> (Seq<CH> ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

Extracts from a list of 'Either' all the 'Right' elements. All the 'Right' elements are extracted in order.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

An enumerable of L

method (IEnumerable<A> Lefts, IEnumerable<B> Rights) partition <CHOICE, CH, A, B> (IEnumerable<CH> ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

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.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

A tuple containing the an enumerable of L and an enumerable of R

method (Seq<A> Lefts, Seq<B> Rights) partition <CHOICE, CH, A, B> (Seq<CH> ma) Source #

where CHOICE : struct, ChoiceUnsafe<CH, A, B>

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.

Parameters

type L

Left

type R

Right

param ma

Choice list

returns

A tuple containing the an enumerable of L and an enumerable of R