LanguageExt.Core

LanguageExt.Core Traits Choice Prelude

Contents

class Prelude Source #

Methods

method K<F, A> choose <F, A> (K<F, A> fa, K<F, A> fb) Source #

where F : Choice<F>

Where F defines some notion of failure or choice, this function picks the first argument that succeeds. So, if fa succeeds, then fa is returned; if it fails, then fb is returned.

Parameters

type F

Alternative structure type

type A

Bound value type

param fa

First structure to test

param fb

Second structure to return if the first one fails

returns

First argument to succeed

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

where F : Choice<F>, Applicative<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.

NOTE: It is important that the F applicative-type overrides Apply (the one with Func laziness) in its trait-implementations otherwise this will likely result in a stack-overflow.

Parameters

param fa

Applicative functor

returns

One or more values

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

where F : Choice<F>, Applicative<F>

Zero or more...

Run the applicative functor repeatedly, collecting the results, until failure. Will always succeed.

NOTE: It is important that the F applicative-type overrides ApplyLazy in its trait-implementations otherwise this will likely result in a stack-overflow.

Parameters

param fa

Applicative functor

returns

Zero or more values