LanguageExt.Core

LanguageExt.Core Extensions

Contents

class ActionObservable <T> Source #

Executes an action post-subscription. This is useful when the action is going to publish to the observable. A kind of request/response. Use the IObservable extension method: PostSubscribe(() => ...)

Methods

method IDisposable Subscribe (IObserver<T> observer) Source #

class ComposeExtensions Source #

Methods

method Func<A, C> BackCompose <A, B, C> (this Func<B, C> g, Func<A, B> f) Source #

Function back composition

Parameters

returns

v => g(f(v))

method Func<B> BackCompose <A, B> (this Func<A, B> g, Func<A> f) Source #

Function back composition

Parameters

returns

() => g(f())

method Action<A> BackCompose <A, B> (this Action<B> g, Func<A, B> f) Source #

Action back composition

Parameters

returns

v => g(f(v))

method Action BackCompose <A> (this Action<A> g, Func<A> f) Source #

Action back composition

Parameters

returns

() => g(f())

method Func<A, C> Compose <A, B, C> (this Func<A, B> f, Func<B, C> g) Source #

Function composition

Parameters

returns

v => g(f(v))

method Func<B> Compose <A, B> (this Func<A> f, Func<A, B> g) Source #

Function composition

Parameters

returns

() => g(f())

method Action<A> Compose <A, B> (this Func<A, B> f, Action<B> g) Source #

Action composition

Parameters

returns

v => g(f(v))

method Action Compose <A> (this Func<A> f, Action<A> g) Source #

Action composition

Parameters

returns

() => g(f())

class FuncExtensions Source #

Methods

method Func<B, A, C> Flip <A, B, C> (this Func<A, B, C> f) Source #

Flip the arguments in a two argument function

method Func<B, Func<A, C>> Flip <A, B, C> (this Func<A, Func<B, C>> f) Source #

Flip the arguments in a two argument function

class ObjectExt Source #

Methods

method bool IsNull <A> (this A value) Source #

Returns true if the value is null, and does so without boxing of any value-types. Value-types will always return false.

Parameters

returns

True if the value is null, and does so without boxing of any value-types. Value-types will always return false.

Examples

int x = 0;
string y = null;

x.IsNull()  // false
y.IsNull()  // true

class ObservableExt Source #

Observable extensions

Methods

method IObservable<T> PostSubscribe <T> ( this IObservable<T> self, Action action) Source #

Executes an action post-subscription. This is useful when the action is going to publish to the observable. A kind of request/response.

method IObservable<T> PostSubscribe <T> ( this IObservable<T> self, Func<Unit> action) Source #

Executes an action post-subscription. This is useful when the action is going to publish to the observable. A kind of request/response.

method IAsyncEnumerable<A> ToAsyncEnumerable <A> ( this IObservable<A> observable, CancellationToken token) Source #

Convert an IObservable to an IAsyncEnumerable

class Query Source #

Methods

method T head <T> (IQueryable<T> list) Source #

method Option<T> headOrNone <T> (IQueryable<T> list) Source #

method Either<L, R> headOrLeft <L, R> (IQueryable<R> list, L left) Source #

method IQueryable<T> tail <T> (IQueryable<T> list) Source #

method IQueryable<R> map <T, R> (IQueryable<T> list, Expression<Func<T, R>> map) Source #

method IQueryable<R> map <T, R> (IQueryable<T> list, Expression<Func<int, T, R>> map) Source #

method IQueryable<T> filter <T> (IQueryable<T> list, Expression<Func<T, bool>> predicate) Source #

method IQueryable<U> choose <T, U> (IQueryable<T> list, Expression<Func<T, Option<U>>> selector) Source #

method IQueryable<U> choose <T, U> (IQueryable<T> list, Expression<Func<int, T, Option<U>>> selector) Source #

method IQueryable<R> collect <T, R> (IQueryable<T> list, Expression<Func<T, IEnumerable<R>>> map) Source #

method int sum (IQueryable<int> list) Source #

method float sum (IQueryable<float> list) Source #

method double sum (IQueryable<double> list) Source #

method decimal sum (IQueryable<decimal> list) Source #

method IQueryable<T> rev <T> (IQueryable<T> list) Source #

method IQueryable<T> append <T> (IQueryable<T> lhs, IQueryable<T> rhs) Source #

method S fold <S, T> (IQueryable<T> list, S state, Expression<Func<S, T, S>> folder) Source #

method S foldBack <S, T> (IQueryable<T> list, S state, Expression<Func<S, T, S>> folder) Source #

method T reduce <T> (IQueryable<T> list, Expression<Func<T, T, T>> reducer) Source #

method T reduceBack <T> (IQueryable<T> list, Expression<Func<T, T, T>> reducer) Source #

method Option<T> find <T> (IQueryable<T> list, Expression<Func<T, bool>> pred) Source #

method Lst<T> freeze <T> (IQueryable<T> list) Source #

method IQueryable<V> zip <T, U, V> (IQueryable<T> list, IEnumerable<U> other, Expression<Func<T, U, V>> zipper) Source #

method int length <T> (IQueryable<T> list) Source #

method bool forall <T> (IQueryable<T> list, Expression<Func<T, bool>> pred) Source #

method IQueryable<T> distinct <T> (IQueryable<T> list) Source #

method IQueryable<T> take <T> (IQueryable<T> list, int count) Source #

method IQueryable<T> takeWhile <T> (IQueryable<T> list, Expression<Func<T, bool>> pred) Source #

method IQueryable<T> takeWhile <T> (IQueryable<T> list, Expression<Func<T, int, bool>> pred) Source #

method bool exists <T> (IQueryable<T> list, Expression<Func<T, bool>> pred) Source #

class QueryExtensions Source #

Methods

method T Head <T> (this IQueryable<T> list) Source #

method Option<T> HeadOrNone <T> (this IQueryable<T> list) Source #

method Either<S, T> HeadOrLeft <S, T> (this IQueryable<T> list, S left) Source #

method IQueryable<T> Tail <T> (this IQueryable<T> list) Source #

method IQueryable<R> Map <T, R> (this IQueryable<T> list, Expression<Func<T, R>> map) Source #

method IQueryable<R> Map <T, R> (this IQueryable<T> list, Expression<Func<int, T, R>> map) Source #

method IQueryable<T> Filter <T> (this IQueryable<T> list, Expression<Func<T, bool>> predicate) Source #

method IQueryable<U> Choose <T, U> (this IQueryable<T> list, Expression<Func<T, Option<U>>> selector) Source #

method IQueryable<U> Choose <T, U> (this IQueryable<T> list, Expression<Func<int, T, Option<U>>> selector) Source #

method IQueryable<R> Collect <T, R> (this IQueryable<T> list, Expression<Func<T, IEnumerable<R>>> map) Source #

method IQueryable<T> Rev <T> (this IQueryable<T> list) Source #

method IQueryable<T> Append <T> (this IQueryable<T> lhs, IQueryable<T> rhs) Source #

method S Fold <S, T> (this IQueryable<T> list, S state, Expression<Func<S, T, S>> folder) Source #

method S FoldBack <S, T> (this IQueryable<T> list, S state, Expression<Func<S, T, S>> folder) Source #

method T Reduce <T> (this IQueryable<T> list, Expression<Func<T, T, T>> reducer) Source #

method T ReduceBack <T> (this IQueryable<T> list, Expression<Func<T, T, T>> reducer) Source #

method Lst<T> Freeze <T> (this IQueryable<T> list) Source #

method IQueryable<V> Zip <T, U, V> (this IQueryable<T> list, IEnumerable<U> other, Expression<Func<T, U, V>> zipper) Source #

method int Length <T> (this IQueryable<T> list) Source #

method bool ForAll <T> (this IQueryable<T> list, Expression<Func<T, bool>> pred) Source #

method IQueryable<T> Distinct <T> (this IQueryable<T> list) Source #

method bool Exists <T> (this IQueryable<T> list, Expression<Func<T, bool>> pred) Source #

class OutExtensions Source #

Methods

method Option<V> TryGetValue <K, V> (this IDictionary<K, V> self, K Key) Source #

Get a value out of a dictionary as Some, otherwise None.

Parameters

type K

Key type

type V

Value type

param self

Dictionary

param Key

Key

returns

OptionT filled Some(value) or None

method Option<V> TryGetValue <K, V> (this IReadOnlyDictionary<K, V> self, K ReadOnlyKey) Source #

Get a value out of a dictionary as Some, otherwise None.

Parameters

type K

Key type

type V

Value type

param self

Dictionary

param ReadOnlyKey

Key

returns

OptionT filled Some(value) or None

class UnsafeValueAccessExtensions Source #

Methods

method A? ValueUnsafe <A> (this Option<A> option) Source #

method A Value <A> (this Option<A> option) Source #

where A : struct

method R Value <L, R> (this Either<L, R> either) Source #

where R : struct

method R? ValueUnsafe <L, R> (this Either<L, R> either) Source #

method Seq<A> ToSeqUnsafe <A> (this A[] value) Source #

This creates a Seq from an Array without any copying of data, so it's super fast However because the input array is mutable it weakens the guarantees of the immutable Seq, so this is not advised unless you know what you're doing.

method Seq<A> ToSeqUnsafe <A> (this A[] value, int length) Source #

This creates a Seq from an Array without any copying of data, so it's super fast However because the input array is mutable it weakens the guarantees of the immutable Seq, so this is not advised unless you know what you're doing.

method SeqLoan<A> ToSeqLoanUnsafe <A> (this A[] value, ArrayPool<A> pool) Source #

This creates a Seq from an Array without any copying of data, so it's super fast However because the input array is mutable it weakens the guarantees of the immutable Seq, so this is not advised unless you know what you're doing.

method SeqLoan<A> ToSeqLoanUnsafe <A> (this A[] value, int length, ArrayPool<A> pool) Source #

This creates a Seq from an Array without any copying of data, so it's super fast However because the input array is mutable it weakens the guarantees of the immutable Seq, so this is not advised unless you know what you're doing.