LanguageExt.Core

LanguageExt.Core Effects Eff Eff with runtime Prelude

Contents

class Prelude Source #

Methods

method Eff<RT, A> SuccessEff <RT, A> (A value) Source #

Construct an successful effect with a pure value

Parameters

type A

Bound value type

param value

Pure value to construct the monad with

returns

Synchronous IO monad that captures the pure value

method Eff<RT, A> FailEff <RT, A> (Error error) Source #

Construct a failed effect

Parameters

type A

Bound value type

param error

Error that represents the failure

returns

Synchronous IO monad that captures the failure

method Eff<RT, RT> runtime <RT> () Source #

Make the runtime into the bound value

method Eff<RT, (RT Runtime, EnvIO EnvIO)> getState <RT> () Source #

Get all of the internal state of the Eff

method Eff<RT, A> localCancel <RT, A> (Eff<RT, A> ma) Source #

Create a new cancellation context and run the provided Aff in that context

Parameters

type RT

Runtime environment

type A

Bound value type

param ma

Operation to run in the next context

returns

An asynchronous effect that captures the operation running in context

method Eff<OuterRT, A> localEff <OuterRT, InnerRT, A> (Func<OuterRT, InnerRT> f, Eff<InnerRT, A> ma) Source #

Create a new local context for the environment by mapping the outer environment and then Create a new local context for the environment by mapping the outer environment and then using the result as a new context when running the IO monad provided

Parameters

param f

Function to map the outer environment into a new one to run ma

param ma

IO monad to run in the new context

method Eff<RT, A> flatten <RT, A> (Eff<RT, Eff<RT, A>> mma) Source #

Monadic join operator

Collapses a nested IO monad so there is no nesting.

Parameters

type RT

Runtime

type E

Error type

type A

Bound value

param mma

Nest IO monad to flatten

returns

Flattened IO monad

method Eff<RT, A> liftEff <RT, A> (Func<RT, Either<Error, A>> f) Source #

Lift an effect into the Eff monad

method Eff<RT, A> liftEff <RT, A> (Func<RT, Fin<A>> f) Source #

Lift an effect into the Eff monad

method Eff<RT, A> liftEff <RT, A> (Func<RT, A> f) Source #

Lift an effect into the Eff monad

method Eff<RT, A> liftEff <RT, A> (Func<RT, Task<A>> f) Source #

Lift an effect into the Eff monad

method Eff<RT, A> liftEff <RT, A> (Func<RT, Task<Fin<A>>> f) Source #

Lift an effect into the Eff monad

method Eff<RT, A> liftEff <RT, A> (IO<A> ma) Source #

Lift an effect into the Eff monad

method Eff<RT, B> map <RT, A, B> (Eff<RT, A> ma, Func<A, B> f) Source #

Maps the IO monad if it's in a success state

Parameters

param f

Function to map the success value with

returns

Mapped IO monad

method Eff<RT, A> mapFail <RT, A> (Eff<RT, A> ma, Func<Error, Error> f) Source #

Maps the IO monad if it's in a success state

Parameters

param f

Function to map the success value with

returns

Mapped IO monad

method Eff<RT, B> bimap <RT, A, B> (Eff<RT, A> ma, Func<A, B> Succ, Func<Error, Error> Fail) Source #

Mapping of either the Success state or the Failure state depending on what state this IO monad is in.

Parameters

param Succ

Mapping to use if the IO monad is in a success state

param Fail

Mapping to use if the IO monad is in a failure state

returns

Mapped IO monad

method Eff<RT, B> match <RT, A, B> (Eff<RT, A> ma, Func<A, B> Succ, Func<Error, B> Fail) Source #

Pattern match the success or failure values and collapse them down to a success value

Parameters

param Succ

Success value mapping

param Fail

Failure value mapping

returns

IO in a success state

method Eff<RT, A> ifFail <RT, A> (Eff<RT, A> ma, Func<Error, A> Fail) Source #

Map the failure to a success value

Parameters

param f

Function to map the fail value

returns

IO in a success state

method Eff<RT, A> ifFailEff <RT, A> (Eff<RT, A> ma, Func<Error, Eff<RT, A>> Fail) Source #

Map the failure to a new IO effect

Parameters

param f

Function to map the fail value

returns

IO that encapsulates that IfFail

method Eff<RT, A> filter <RT, A> (Eff<RT, A> ma, Func<A, bool> predicate) Source #

Only allow values through the effect if the predicate returns true for the bound value

Parameters

param predicate

Predicate to apply to the bound value>

returns

Filtered IO

method Eff<RT, A> EffMaybe <RT, A> (Func<RT, Fin<A>> f) Source #

Construct an effect that will either succeed, have an exceptional, or unexceptional failure

Parameters

type A

Bound value type

param f

Function to capture the effect

returns

Synchronous IO monad that captures the effect

method Eff<RT, A> Eff <RT, A> (Func<RT, A> f) Source #

Construct an effect that will either succeed or have an exceptional failure

Parameters

type A

Bound value type

param f

Function to capture the effect

returns

Synchronous IO monad that captures the effect

class Prelude Source #

Methods

method Eff<RT, B> map <RT, A, B> (Func<A, B> f, K<Eff<RT>, 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

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

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

Applicative action: runs the first applicative, ignores the result, and returns the second applicative

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

Applicative functor apply operation

Unwraps the value within the ma applicative-functor, passes it to the unwrapped function(s) within mf, and then takes the resulting value and wraps it back up into a new applicative-functor.

Parameters

param ma

Value(s) applicative functor

param mf

Mapping function(s)

returns

Mapped applicative functor