LanguageExt.Core

LanguageExt.Core Traits Applicative

Applicative Functors are a 'stepping stone' between functors and monads – they're probably less well-known but have some interesting properties of their own when it comes to lifted expression evaluation.

Two of the major uses in language-ext is to enable automatic parallel processing of effectful computations and to automatically collect multiple errors when validating. Those aren't the only usages – all the higher-kinded-types, including the collection-types, have applicative traits.

The topic is too large to cover here, so take a look at Paul Louth's Higher-Kinds series for more information.

Contents

class ApplicativeExtensions Source #

Monad module

Methods

method K<M, B> ApplyM <M, A, B> (this K<M, Func<A, K<M, B>>> mf, K<M, A> ma) Source #

where M : Monad<M>

method K<AF, B> Apply <AF, A, B> (this K<AF, Func<A, B>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, B> Apply <AF, A, B> (this K<AF, Func<A, B>> mf, Func<K<AF, A>> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B, C>> Apply <AF, A, B, C> (this K<AF, Func<A, B, C>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, D>>> Apply <AF, A, B, C, D> (this K<AF, Func<A, B, C, D>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, E>>>> Apply <AF, A, B, C, D, E> (this K<AF, Func<A, B, C, D, E>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, F>>>>> Apply <AF, A, B, C, D, E, F> (this K<AF, Func<A, B, C, D, E, F>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, G>>>>>> Apply <AF, A, B, C, D, E, F, G> (this K<AF, Func<A, B, C, D, E, F, G>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, H>>>>>>> Apply <AF, A, B, C, D, E, F, G, H> (this K<AF, Func<A, B, C, D, E, F, G, H>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, I>>>>>>>> Apply <AF, A, B, C, D, E, F, G, H, I> (this K<AF, Func<A, B, C, D, E, F, G, H, I>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, Func<I, J>>>>>>>>> Apply <AF, A, B, C, D, E, F, G, H, I, J> (this K<AF, Func<A, B, C, D, E, F, G, H, I, J>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, Func<I, Func<J, K>>>>>>>>>> Apply <AF, A, B, C, D, E, F, G, H, I, J, K> (this K<AF, Func<A, B, C, D, E, F, G, H, I, J, K>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<F, B> Action <F, A, B> (this K<F, A> ma, K<F, B> mb) Source #

where F : Applicative<F>

method K<F, A> Actions <F, A> (this IEnumerable<K<F, A>> ma) Source #

where F : Applicative<F>

method K<F, A> Actions <F, A> (this IAsyncEnumerable<K<F, A>> ma) Source #

where F : Applicative<F>

method K<F, B> Lift <F, A, B> (this Func<A, B> f, K<F, A> fa) Source #

where F : Applicative<F>

method K<F, C> Lift <F, A, B, C> (this Func<A, B, C> f, K<F, A> fa, K<F, B> fb) Source #

where F : Applicative<F>

method K<F, C> Lift <F, A, B, C> (this Func<A, Func<B, C>> f, K<F, A> fa, K<F, B> fb) Source #

where F : Applicative<F>

method K<F, D> Lift <F, A, B, C, D> (this Func<A, B, C, D> f, K<F, A> fa, K<F, B> fb, K<F, C> fc) Source #

where F : Applicative<F>

method K<F, D> Lift <F, A, B, C, D> (this Func<A, Func<B, Func<C, D>>> f, K<F, A> fa, K<F, B> fb, K<F, C> fc) Source #

where F : Applicative<F>

method K<Fnctr, R> Apply <Fnctr, A, B, R> ( this (K<Fnctr, A>, K<Fnctr, B>) items, Func<A, B, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, R> ( this (K<M, A>, K<M, B>) items, Func<A, B, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>) items, Func<A, B, C, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, R> ( this (K<M, A>, K<M, B>, K<M, C>) items, Func<A, B, C, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>) items, Func<A, B, C, D, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>) items, Func<A, B, C, D, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, E, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>, K<Fnctr, E>) items, Func<A, B, C, D, E, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, E, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>, K<M, E>) items, Func<A, B, C, D, E, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, E, F, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>, K<Fnctr, E>, K<Fnctr, F>) items, Func<A, B, C, D, E, F, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, E, F, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>, K<M, E>, K<M, F>) items, Func<A, B, C, D, E, F, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, E, F, G, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>, K<Fnctr, E>, K<Fnctr, F>, K<Fnctr, G>) items, Func<A, B, C, D, E, F, G, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, E, F, G, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>, K<M, E>, K<M, F>, K<M, G>) items, Func<A, B, C, D, E, F, G, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, E, F, G, H, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>, K<Fnctr, E>, K<Fnctr, F>, K<Fnctr, G>, K<Fnctr, H>) items, Func<A, B, C, D, E, F, G, H, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, E, F, G, H, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>, K<M, E>, K<M, F>, K<M, G>, K<M, H>) items, Func<A, B, C, D, E, F, G, H, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, E, F, G, H, I, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>, K<Fnctr, E>, K<Fnctr, F>, K<Fnctr, G>, K<Fnctr, H>, K<Fnctr, I>) items, Func<A, B, C, D, E, F, G, H, I, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, E, F, G, H, I, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>, K<M, E>, K<M, F>, K<M, G>, K<M, H>, K<M, I>) items, Func<A, B, C, D, E, F, G, H, I, K<M, R>> f) Source #

where M : Monad<M>

method K<Fnctr, R> Apply <Fnctr, A, B, C, D, E, F, G, H, I, J, R> ( this (K<Fnctr, A>, K<Fnctr, B>, K<Fnctr, C>, K<Fnctr, D>, K<Fnctr, E>, K<Fnctr, F>, K<Fnctr, G>, K<Fnctr, H>, K<Fnctr, I>, K<Fnctr, J>) items, Func<A, B, C, D, E, F, G, H, I, J, R> f) Source #

where Fnctr : Applicative<Fnctr>

method K<M, R> ApplyM <M, A, B, C, D, E, F, G, H, I, J, R> ( this (K<M, A>, K<M, B>, K<M, C>, K<M, D>, K<M, E>, K<M, F>, K<M, G>, K<M, H>, K<M, I>, K<M, J>) items, Func<A, B, C, D, E, F, G, H, I, J, K<M, R>> f) Source #

where M : Monad<M>

method K<F, A> Add <NumA, F, A> (this K<F, A> fa, K<F, A> fb) Source #

where F : Applicative<F>
where NumA : Num<A>

Sum the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

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

where F : Applicative<F>
where A : IAdditionOperators<A, A, A>

Sum the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

method K<F, A> Subtract <NumA, F, A> (this K<F, A> fa, K<F, A> fb) Source #

where F : Applicative<F>
where NumA : Arithmetic<A>

Subtract the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

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

where F : Applicative<F>
where A : ISubtractionOperators<A, A, A>

Subtract the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

method K<F, A> Multiply <NumA, F, A> (this K<F, A> fa, K<F, A> fb) Source #

where F : Applicative<F>
where NumA : Arithmetic<A>

Multiply the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

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

where F : Applicative<F>
where A : IMultiplyOperators<A, A, A>

Multiply the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

method K<F, A> Divide <NumA, F, A> (this K<F, A> fa, K<F, A> fb) Source #

where F : Applicative<F>
where NumA : Num<A>

Multiply the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

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

where F : Applicative<F>
where A : IDivisionOperators<A, A, A>

Multiply the bound values of the applicative structures provided

Parameters

type NumA

Num of A

type A

Bound value type

param fx

Left hand side of the operation

param fy

Right hand side of the operation

returns

An applicative structure with the arithmetic operation applied to the bound values.

method K<F, (A First, B Second)> Zip <F, A, B> ( this (K<F, A> First, K<F, B> Second) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second, C Third)> Zip <F, A, B, C> ( this (K<F, A> First, K<F, B> Second, K<F, C> Third) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth)> Zip <F, A, B, C, D> ( this (K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth, E Fifth)> Zip <F, A, B, C, D, E> ( this (K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth, K<F, E> Fifth) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second)> Zip <F, A, B> ( this K<F, A> First, K<F, B> Second) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

param First

First applicative

param Second

Second applicative

returns

Zipped applicative

method K<F, (A First, B Second, C Third)> Zip <F, A, B, C> ( this K<F, A> First, K<F, B> Second, K<F, C> Third) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

param First

First applicative

param Second

Second applicative

param Third

Third applicative

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth)> Zip <F, A, B, C, D> ( this K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param First

First applicative

param Second

Second applicative

param Third

Third applicative

param Fourth

Fourth applicative

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth, E Fifth)> Zip <F, A, B, C, D, E> ( this K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth, K<F, E> Fifth) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param First

First applicative

param Second

Second applicative

param Third

Third applicative

param Fourth

Fourth applicative

param Fifth

Fifth applicative

returns

Zipped applicative

class ApplicativeLaw <F> Source #

where F : Applicative<F>

Functions that test that Applicative-functor laws hold for the F applicative-functor provided.

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your applicative-functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

Parameters

type F

Applicative functor type

Methods

method Unit assert (Func<K<F, int>, K<F, int>, bool>? equals = null) Source #

Assert that the applicative-functor laws hold

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your applicative-functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

method Validation<Error, Unit> validate (Func<K<F, int>, K<F, int>, bool>? equals = null) Source #

Validate that the applicative-functor laws hold

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your applicative-functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

method Validation<Error, Unit> homomorphismLaw (Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the homomorphism law

Homomorphism: pure g <*> pure x ≡ pure (g x)

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your applicative-functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

method Validation<Error, Unit> interchangeLaw (Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the interchange law

Interchange: fs <> pure x ≡ pure ($ x) <> fs

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your applicative-functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

method Validation<Error, Unit> identityLaw (Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the identity law

Identity: pure id <*> xs ≡ xs

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your applicative-functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

method Validation<Error, Unit> compositionLaw (Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the composition law

Composition: (.) <$> us <> vs <> xs ≡ us <> (vs <> xs)

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

method Validation<Error, Unit> functorLaw (Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the composition law

Applicative-Functor: g <$> xs ≡ pure g <*> xs

NOTE: Equals must be implemented for the K<F, *> derived-type, so that the laws can be proven to be true. If your functor doesn't have Equals then you must provide the optional equals parameter so that the equality of outcomes can be tested.

class Applicative Source #

Applicative module

Methods

method K<F, A> pure <F, A> (A value) Source #

where F : Applicative<F>

method K<F, B> apply <F, A, B> (K<F, Func<A, B>> mf, K<F, A> ma) Source #

where F : Applicative<F>

method K<F, Func<B, C>> apply <F, A, B, C> (K<F, Func<A, B, C>> mf, K<F, A> ma) Source #

where F : Applicative<F>

method K<F, C> apply <F, A, B, C> (K<F, Func<A, B, C>> mf, K<F, A> ma, K<F, B> mb) Source #

where F : Applicative<F>

method K<F, D> apply <F, A, B, C, D> (K<F, Func<A, B, C, D>> mf, K<F, A> ma, K<F, B> mb, K<F, C> mc) Source #

where F : Applicative<F>

method K<F, Func<C, D>> apply <F, A, B, C, D> (K<F, Func<A, B, C, D>> mf, K<F, A> ma, K<F, B> mb) Source #

where F : Applicative<F>

method K<F, Func<B,Func<C, D>>> apply <F, A, B, C, D> (K<F, Func<A, B, C, D>> mf, K<F, A> ma) Source #

where F : Applicative<F>

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

where F : Applicative<F>

method K<F, A> actions <F, A> (IEnumerable<K<F, A>> ma) Source #

where F : Applicative<F>

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

where F : Applicative<F>

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

where F : Applicative<F>

method K<F, B> lift <F, A, B> (Func<A, B> f, K<F, A> fa) Source #

where F : Applicative<F>

method K<F, C> lift <F, A, B, C> (Func<A, B, C> f, K<F, A> fa, K<F, B> fb) Source #

where F : Applicative<F>

method K<F, C> lift <F, A, B, C> (Func<A, Func<B, C>> f, K<F, A> fa, K<F, B> fb) Source #

where F : Applicative<F>

method K<F, D> lift <F, A, B, C, D> (Func<A, B, C, D> f, K<F, A> fa, K<F, B> fb, K<F, C> fc) Source #

where F : Applicative<F>

method K<F, D> lift <F, A, B, C, D> (Func<A, Func<B, Func<C, D>>> f, K<F, A> fa, K<F, B> fb, K<F, C> fc) Source #

where F : Applicative<F>

class Prelude Source #

Methods

method K<F, A> pure <F, A> (A value) Source #

where F : Applicative<F>

Construct an applicative structure from a pure value

Parameters

type A

Bound value type

param value

Pure value to lift into the applicative structure

returns

Applicative structure

method K<M, B> applyM <M, A, B> (K<M, Func<A, K<M, B>>> mf, K<M, A> ma) Source #

where M : Monad<M>

method K<AF, B> apply <AF, A, B> (K<AF, Func<A, B>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B, C>> apply <AF, A, B, C> (K<AF, Func<A, B, C>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, D>>> apply <AF, A, B, C, D> (K<AF, Func<A, B, C, D>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, E>>>> apply <AF, A, B, C, D, E> (K<AF, Func<A, B, C, D, E>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, F>>>>> apply <AF, A, B, C, D, E, F> (K<AF, Func<A, B, C, D, E, F>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, G>>>>>> apply <AF, A, B, C, D, E, F, G> (K<AF, Func<A, B, C, D, E, F, G>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, H>>>>>>> apply <AF, A, B, C, D, E, F, G, H> (K<AF, Func<A, B, C, D, E, F, G, H>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, I>>>>>>>> apply <AF, A, B, C, D, E, F, G, H, I> (K<AF, Func<A, B, C, D, E, F, G, H, I>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, Func<I, J>>>>>>>>> apply <AF, A, B, C, D, E, F, G, H, I, J> (K<AF, Func<A, B, C, D, E, F, G, H, I, J>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

method K<AF, Func<B,Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, Func<I, Func<J, K>>>>>>>>>> apply <AF, A, B, C, D, E, F, G, H, I, J, K> (K<AF, Func<A, B, C, D, E, F, G, H, I, J, K>> mf, K<AF, A> ma) Source #

where AF : Applicative<AF>

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

where F : Applicative<F>

method K<F, A> actions <F, A> (IEnumerable<K<F, A>> ma) Source #

where F : Applicative<F>

method K<F, A> actions <F, A> (IAsyncEnumerable<K<F, A>> ma) Source #

where F : Applicative<F>

method K<F, (A First, B Second)> zip <F, A, B> ( (K<F, A> First, K<F, B> Second) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second, C Third)> zip <F, A, B, C> ( (K<F, A> First, K<F, B> Second, K<F, C> Third) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth)> zip <F, A, B, C, D> ( (K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth, E Fifth)> zip <F, A, B, C, D, E> ( (K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth, K<F, E> Fifth) tuple) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param tuple

Tuple of applicatives to run

returns

Zipped applicative

method K<F, (A First, B Second)> zip <F, A, B> ( K<F, A> First, K<F, B> Second) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

param First

First applicative

param Second

Second applicative

returns

Zipped applicative

method K<F, (A First, B Second, C Third)> zip <F, A, B, C> ( K<F, A> First, K<F, B> Second, K<F, C> Third) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

param First

First applicative

param Second

Second applicative

param Third

Third applicative

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth)> zip <F, A, B, C, D> ( K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param First

First applicative

param Second

Second applicative

param Third

Third applicative

param Fourth

Fourth applicative

returns

Zipped applicative

method K<F, (A First, B Second, C Third, D Fourth, E Fifth)> zip <F, A, B, C, D, E> ( K<F, A> First, K<F, B> Second, K<F, C> Third, K<F, D> Fourth, K<F, E> Fifth) Source #

where F : Applicative<F>

Zips applicatives into a tuple

Parameters

type F

Applicative trait type

type A

First applicative's bound value type

type B

Second applicative's bound value type

type C

Third applicative's bound value type

type D

Fourth applicative's bound value type

param First

First applicative

param Second

Second applicative

param Third

Third applicative

param Fourth

Fourth applicative

param Fifth

Fifth applicative

returns

Zipped applicative

interface Applicative <F> Source #

where F : Applicative<F>

Applicative functor

Parameters

type F

Functor trait type

type A

Bound value type

Methods

method K<F, A> Pure <A> (A value) Source #

method K<F, B> Apply <A, B> (K<F, Func<A, B>> mf, K<F, A> ma) Source #

method K<F, B> ApplyLazy <A, B> (K<F, Func<A, B>> mf, Func<K<F, A>> ma) Source #

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

method K<F, C> Apply <A, B, C> (K<F, Func<A, B, C>> mf, K<F, A> ma, K<F, B> mb) Source #

method K<F, Func<B, C>> Apply <A, B, C> (K<F, Func<A, B, C>> mf, K<F, A> ma) Source #

method K<F, C> Apply <A, B, C> (K<F, Func<A, Func<B, C>>> mf, K<F, A> ma, K<F, B> mb) Source #

method K<F, A> Actions <A> (params K<F, A>[] fas) Source #

Chains a sequence of applicative actions

Because this is an abstract chaining of actions, it can't actually run anything, and so if your actions are expected to have side-effects (IO effects, for example), then you won't see them until the resulting K<F, A> is 'run'.

This matters for infinite streams, where the result of Actions isn't realised at all, and so to avoid nothing happening (no side-effects), you should override this function and unpack the IO type within, then run that enumerable of IOs.

A good example is with the Eff type. It's a ReaderT<IO, A> internally:

static K<Eff<RT>, A> Actions<A>(IEnumerable<K<Eff<RT>, A>> fas) =>
    new Eff<RT, A>(
        new ReaderT<RT, IO, A>(
            rt => fas.Select(fa => fa.RunIO(rt)).Actions()));

Parameters

type A

Bound value type

param fas

Actions to chain

returns

method K<F, A> Actions <A> (Seq<K<F, A>> fas) Source #

Chains a sequence of applicative actions

Because this is an abstract chaining of actions, it can't actually run anything, and so if your actions are expected to have side-effects (IO effects, for example), then you won't see them until the resulting K<F, A> is 'run'.

This matters for infinite streams, where the result of Actions isn't realised at all, and so to avoid nothing happening (no side-effects), you should override this function and unpack the IO type within, then run that enumerable of IOs.

A good example is with the Eff type. It's a ReaderT<IO, A> internally:

static K<Eff<RT>, A> Actions<A>(IEnumerable<K<Eff<RT>, A>> fas) =>
    new Eff<RT, A>(
        new ReaderT<RT, IO, A>(
            rt => fas.Select(fa => fa.RunIO(rt)).Actions()));

Parameters

type A

Bound value type

param fas

Actions to chain

returns

method K<F, A> Actions <A> (IEnumerable<K<F, A>> fas) Source #

Chains a sequence of applicative actions

Because this is an abstract chaining of actions, it can't actually run anything, and so if your actions are expected to have side effects (IO effects, for example), then you won't see them until the resulting K<F, A> is 'run'.

This matters for infinite streams, where the result of Actions isn't realised at all, and so to avoid nothing happening (no side effects), you should override this function and unpack the IO type within, then run that enumerable of IOs.

A good example is with the Eff type. It's a ReaderT<IO, A> internally:

static K<Eff<RT>, A> Actions<A>(IEnumerable<K<Eff<RT>, A>> fas) =>
    new Eff<RT, A>(
        new ReaderT<RT, IO, A>(
            rt => fas.Select(fa => fa.RunIO(rt)).Actions()));

Parameters

type A

Bound value type

param fas

Actions to chain

returns

method K<F, A> Actions <A> (IAsyncEnumerable<K<F, A>> fas) Source #

Chains a sequence of applicative actions

Because this is an abstract chaining of actions, it can't actually run anything, and so if your actions are expected to have side effects (IO effects, for example), then you won't see them until the resulting K<F, A> is 'run'.

This matters for infinite streams, where the result of Actions isn't realised at all, and so to avoid nothing happening (no side effects), you should override this function and unpack the IO type within, then run that enumerable of IOs.

A good example is with the Eff type. It's a ReaderT<IO, A> internally:

static K<Eff<RT>, A> Actions<A>(IEnumerable<K<Eff<RT>, A>> fas) =>
    new Eff<RT, A>(
        new ReaderT<RT, IO, A>(
            rt => fas.Select(fa => fa.RunIO(rt)).Actions()));

Parameters

type A

Bound value type

param fas

Actions to chain

returns