LanguageExt.Core

LanguageExt.Core Traits Functor

Contents

class FunctorExtensions Source #

Methods

method K<F, Unit> IgnoreF <F, A> (this K<F, A> fa) Source #

where F : Functor<F>

Ignores the bound value result and instead maps it to Unit

Parameters

type F

Functor trait

type A

Bound value type

param fa

Functor that returns a bound value that should be ignored

returns

Functor with unit bound value

method K<F, C> SelectMany <F, A, C> ( this K<F, A> ma, Func<A, Guard<Error, Unit>> bind, Func<A, Unit, C> project) Source #

where F : Functor<F>

Monad bind operation

Parameters

type F

Functor trait

type A

Initial bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

M〈C〉

method K<F, C> SelectMany <F, A, C> ( this K<F, A> ma, Func<A, Guard<Fail<Error>, Unit>> bind, Func<A, Unit, C> project) Source #

where F : Functor<F>

Monad bind operation

Parameters

type F

Functor trait

type A

Initial bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

M〈C〉

method K<F, C> SelectMany <F, B, C> ( this Guard<Error, Unit> ma, Func<Unit, K<F, B>> bind, Func<Unit, B, C> project) Source #

where F : Functor<F>

Monad bind operation

Parameters

type F

Functor trait

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

M〈C〉

method K<F, C> SelectMany <F, B, C> ( this Guard<Fail<Error>, Unit> ma, Func<Unit, K<F, B>> bind, Func<Unit, B, C> project) Source #

where F : Functor<F>

Monad bind operation

Parameters

type F

Functor trait

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

M〈C〉

method K<Fnctr, B> Map <Fnctr, A, B> ( this K<Fnctr, A> ma, Func<A, B> f) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, B> Map <Fnctr, A, B> ( this K<Fnctr, A> ma, B value) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Invokes the functor, extracting its bound value, which it then ignores and then maps to the default value provided. This is useful for side-effecting monads that have an effect on the world, which the result value can be ignored, to then return a default.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param value

Ignore the bound value and map to this

returns

Mapped functor

method K<Fnctr, B> Select <Fnctr, A, B> ( this K<Fnctr, A> ma, Func<A, B> f) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, B> Map <Fnctr, A, B> ( this Func<A, B> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, C>> Map <Fnctr, A, B, C> ( this Func<A, B, C> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, D>>> Map <Fnctr, A, B, C, D> ( this Func<A, B, C, D> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, E>>>> Map <Fnctr, A, B, C, D, E> ( this Func<A, B, C, D, E> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, F>>>>> Map <Fnctr, A, B, C, D, E, F> ( this Func<A, B, C, D, E, F> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

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

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

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

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

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

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

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

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

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

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

class FunctorExtensions Source #

Methods

method K<M, K<N, B>> MapT <M, N, A, B> (this K<M, K<N, A>> mna, Func<A, B> f) Source #

where M : Functor<M>
where N : Functor<N>

Runs a functor map operation on the nested functors

If you're working with an inner functor that is concrete then you will first need to call KindT to cast the functor to a more general K version. This enables the T variant extensions (like BindT, `MapT, etc.) to work without providing excessive generic arguments all the way down the chain.

Parameters

type NA

N〈A〉

type M

Outer functor trait

type N

Inner functor trait

type A

Input bound value

type B

Output bound value

param mna

Nested functor value

param f

Bind function

returns

Mapped value

Examples

var mx = Seq〈Option〈int〉〉(Some(1), Some(2), Some(3)); var ma = mx.MapT(a => a + 1);

class FunctorLaw <F> Source #

where F : Functor<F>

Functions that test that functor-laws hold for the F 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 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

Functor type

Methods

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

Assert that the 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 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 (K<F, int> fa, Func<K<F, int>, K<F, int>, bool>? equals = null) Source #

Validate that the 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 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 (K<F, int> lhs, Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the identity law

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> compositionLaw ( K<F, int> fa, Func<int, int> f, Func<int, int> g, Func<K<F, int>, K<F, int>, bool> equals) Source #

Validate the composition law

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 Functor Source #

Functor module

Methods

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

where F : Functor<F>

Functor map. Maps all contained values of A to values of B

Parameters

type F

Functor trait

type A

Bound value type

type B

Resulting bound value type

param f

Mapping function

param fa

Functor structure

returns

Mapped functor

method K<F, Unit> ignore <F, A> (K<F, A> fa) Source #

where F : Functor<F>

Ignores the bound value result and instead maps it to Unit

Parameters

type F

Functor trait

type A

Bound value type

param fa

Functor that returns a bound value that should be ignored

returns

Functor with unit bound value

class Prelude Source #

Methods

method K<F, Unit> ignore <F, A> (K<F, A> fa) Source #

where F : Functor<F>

Ignores the bound value result and instead maps it to Unit

Parameters

type F

Functor trait

type A

Bound value type

param fa

Functor that returns a bound value that should be ignored

returns

Functor with unit bound value

method K<Fnctr, B> map <Fnctr, A, B> ( Func<A, B> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, C>> map <Fnctr, A, B, C> ( Func<A, B, C> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, D>>> map <Fnctr, A, B, C, D> ( Func<A, B, C, D> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, E>>>> map <Fnctr, A, B, C, D, E> ( Func<A, B, C, D, E> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, F>>>>> map <Fnctr, A, B, C, D, E, F> ( Func<A, B, C, D, E, F> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, Func<F, G>>>>>> map <Fnctr, A, B, C, D, E, F, G> ( Func<A, B, C, D, E, F, G> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, Func<F, Func<G, H>>>>>>> map <Fnctr, A, B, C, D, E, F, G, H> ( Func<A, B, C, D, E, F, G, H> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, I>>>>>>>> map <Fnctr, A, B, C, D, E, F, G, H, I> ( Func<A, B, C, D, E, F, G, H, I> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, Func<I, J>>>>>>>>> map <Fnctr, A, B, C, D, E, F, G, H, I, J> ( Func<A, B, C, D, E, F, G, H, I, J> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method K<Fnctr, Func<B, Func<C, Func<D, Func<E, Func<F, Func<G, Func<H, Func<I, Func<J, K>>>>>>>>>> map <Fnctr, A, B, C, D, E, F, G, H, I, J, K> ( Func<A, B, C, D, E, F, G, H, I, J, K> f, K<Fnctr, A> ma) Source #

where Fnctr : Functor<Fnctr>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

This variant takes the passed function and partially applies it, so the result is a functor within the value being the partially applied function. If Fnctr is also an Applicative, which is often the case, you can provide further arguments to the partially applied function by calling .Apply() on the resulting functor.

You can continue this until all arguments have been provided and then you'll have a functor within the result of the function wrapped up inside.

Parameters

type Fnctr

Trait of the functor

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

interface Functor <F> Source #

where F : Functor<F>

Functor trait

Map is used to apply a function of type Func〈A, B〉 to a value of type K〈F, A〉 where F is a functor, to produce a value of type K〈F, B〉.

Note that for any type with more than one parameter (e.g., Either), only the last type parameter can be modified with Map (e.g. R in Either〈L, R〉).

Some types two generic parameters or more have a Bifunctor instance that allows both the last and the penultimate parameters to be mapped over.

Parameters

type F

Self referring type

Methods

method K<F, B> Map <A, B> (Func<A, B> f, K<F, A> ma) Source #

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

type Fnctr

Trait of the functor

param f

Mapping function

param ma

Functor to map

returns

Mapped functor