LanguageExt.Core

LanguageExt.Core Traits Alternative

Contents

class AlternativeExtensions Source #

A monoid on applicative functors

Parameters

type F

Applicative functor

Methods

method K<M, A> Filter <M, A> (this K<M, A> ma, Func<A, bool> predicate) Source #

where M : Alternative<M>, Monad<M>

Results in Empty if the predicate results in false

method K<M, A> Where <M, A> (this K<M, A> ma, Func<A, bool> predicate) Source #

where M : Alternative<M>, Monad<M>

Results in Empty if the predicate results in false

method K<M, B> Choose <M, A, B> (this K<M, A> ma, Func<A, Option<B>> selector) Source #

where M : Alternative<M>, Monad<M>

Chooses whether an element of the structure should be propagated through and if so maps the resulting value at the same time.

method K<F, A> OneOf <F, A> (this Seq<K<F, A>> ms) Source #

where F : Alternative<F>

Given a set of applicative functors, return the first one to succeed.

If none succeed, the last applicative functor will be returned.

method K<F, Seq<A>> Some <F, A> (this K<F, A> v) Source #

where F : Alternative<F>

One or more...

Run the applicative functor repeatedly, collecting the results, until failure.

Will always succeed if at least one item has been yielded.

Parameters

param v

Applicative functor

returns

One or more values

method K<F, Seq<A>> Many <F, A> (this K<F, A> v) Source #

where F : Alternative<F>

Zero or more...

Run the applicative functor repeatedly, collecting the results, until failure.

Will always succeed.

Parameters

param v

Applicative functor

returns

Zero or more values

class Alternative Source #

A monoid on applicative functors

Parameters

type F

Applicative functor

Methods

method K<F, A> empty <F, A> () Source #

where F : Alternative<F>

Identity

Parameters

type A
returns

method K<F, A> combine <F, A> (K<F, A> ma, K<F, A> mb) Source #

where F : SemiAlternative<F>

Associative binary operator

method K<F, A> oneOf <F, A> (params K<F, A>[] ms) Source #

where F : Alternative<F>

Given a set of applicative functors, return the first one to succeed.

If none succeed, the last applicative functor will be returned.

method K<F, A> oneOf <F, A> (Seq<K<F, A>> ms) Source #

where F : Alternative<F>

Given a set of applicative functors, return the first one to succeed.

If none succeed, the last applicative functor will be returned.

method K<F, Seq<A>> some <F, A> (K<F, A> v) Source #

where F : Alternative<F>

One or more...

Run the applicative functor repeatedly, collecting the results, until failure.

Will always succeed if at least one item has been yielded.

Parameters

param v

Applicative functor

returns

One or more values

method K<F, Seq<A>> many <F, A> (K<F, A> v) Source #

where F : Alternative<F>

Zero or more...

Run the applicative functor repeatedly, collecting the results, until failure.

Will always succeed.

Parameters

param v

Applicative functor

returns

Zero or more values

method K<F, Unit> guard <F> (bool flag) Source #

where F : Alternative<F>

Conditional failure of Alternative computations. Defined by

guard(true)  = Applicative.pure
guard(false) = Alternative.empty

Parameters

type F
param flag
returns

interface Alternative <F> Source #

where F : Alternative<F>

A monoid on applicative functors

Parameters

type F

Applicative functor

Methods

method K<F, Seq<A>> Some <A> (K<F, A> v) Source #

One or more...

Run the applicative functor repeatedly, collecting the results, until failure.

Will always succeed if at least one item has been yielded.

Parameters

param v

Applicative functor

returns

One or more values

method K<F, Seq<A>> Many <A> (K<F, A> v) Source #

Zero or more...

Run the applicative functor repeatedly, collecting the results, until failure.

Will always succeed.

Parameters

param v

Applicative functor

returns

Zero or more values