Orsak


Effect Module

Functions and values

Function or value Description

Effect.bind f e

Full Usage: Effect.bind f e

Parameters:
    f : 'a -> Effect<'r, 'b, 'e> - The continuation function to run in case e succeeds.
    e : Effect<'r, 'a, 'e> - The effect

Returns: Effect<'r, 'b, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'b, 'e

Monadic bind of the effect.

f : 'a -> Effect<'r, 'b, 'e>

The continuation function to run in case e succeeds.

e : Effect<'r, 'a, 'e>

The effect

Returns: Effect<'r, 'b, 'e>

Effect.bindNewError e f

Full Usage: Effect.bindNewError e f

Parameters:
    e : Effect<'r, 'a, 'e1> - The effect
    f : 'a -> Effect<'r, 'b, 'e2> - Function which produces an effect that fails with a different error

Returns: Effect<'r, 'b, Choice<'e1, 'e2>>

Binds an effect with an effect of a different error type

e : Effect<'r, 'a, 'e1>

The effect

f : 'a -> Effect<'r, 'b, 'e2>

Function which produces an effect that fails with a different error

Returns: Effect<'r, 'b, Choice<'e1, 'e2>>

Effect.changeError f e

Full Usage: Effect.changeError f e

Parameters:
    f : 'e1 -> 'e2 - Function which maps the error, in case the effect had failed
    e : Effect<'r, 'a, 'e1> - The effect

Returns: Effect<'r, 'a, 'e2>

Transforms an effect which fails with an error of to an effect which fails with an error of type .

f : 'e1 -> 'e2

Function which maps the error, in case the effect had failed

e : Effect<'r, 'a, 'e1>

The effect

Returns: Effect<'r, 'a, 'e2>

Effect.join e

Full Usage: Effect.join e

Parameters:
Returns: Effect<'a, 'b, 'c>
Modifiers: inline

Monadic join of the effect.

e : Effect<'a, Effect<'a, 'b, 'c>, 'c>

The effect

Returns: Effect<'a, 'b, 'c>

Effect.joinResult e

Full Usage: Effect.joinResult e

Parameters:
Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Merges an inner result with its surrounding effect.

e : Effect<'r, Result<'a, 'e>, 'e>

The effect

Returns: Effect<'r, 'a, 'e>

Effect.joinTask e

Full Usage: Effect.joinTask e

Parameters:
Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Merges an inner task with its surrounding effect.

e : Effect<'r, Task<'a>, 'e>

The effect

Returns: Effect<'r, 'a, 'e>

Effect.map f e

Full Usage: Effect.map f e

Parameters:
    f : 'a -> 'b - The continuation function to run in case e succeeds.
    e : Effect<'r, 'a, 'e> - The effect

Returns: Effect<'r, 'b, 'e>
Modifiers: inline
Type parameters: 'a, 'b, 'r, 'e

map of the effect.

f : 'a -> 'b

The continuation function to run in case e succeeds.

e : Effect<'r, 'a, 'e>

The effect

Returns: Effect<'r, 'b, 'e>

Effect.map2 f s1 s2

Full Usage: Effect.map2 f s1 s2

Parameters:
    f : 'a -> 'b -> 'c
    s1 : Effect<'d, 'a, 'e>
    s2 : Effect<'d, 'b, 'e>

Returns: Effect<'d, 'c, 'e>

map2 of the effect.

f : 'a -> 'b -> 'c
s1 : Effect<'d, 'a, 'e>
s2 : Effect<'d, 'b, 'e>
Returns: Effect<'d, 'c, 'e>

Effect.onError f e

Full Usage: Effect.onError f e

Parameters:
    f : 'e -> Effect<'r, 'a, 'e> - The function to run in case of failure
    e : Effect<'r, 'a, 'e> - The effect

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'e, 'r, 'a

Potentially recovers a failed effect by producing a new effect in case of failure. If the effect was already successful, f is never run.

f : 'e -> Effect<'r, 'a, 'e>

The function to run in case of failure

e : Effect<'r, 'a, 'e>

The effect

Returns: Effect<'r, 'a, 'e>

Effect.par eff

Full Usage: Effect.par eff

Parameters:
    eff : seq<Effect<'r, 'a, 'e>>

Returns: Effect<'r, 'a list, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Executes effects in parallel if possible. Currently not efficiently implemented.

eff : seq<Effect<'r, 'a, 'e>>
Returns: Effect<'r, 'a list, 'e>

Effect.par_ eff

Full Usage: Effect.par_ eff

Parameters:
    eff : seq<Effect<'r, unit, 'e>>

Returns: Effect<'r, unit, 'e>
Modifiers: inline
Type parameters: 'r, 'e

Executes effects in parallel if possible. Currently not efficiently implemented.

eff : seq<Effect<'r, unit, 'e>>
Returns: Effect<'r, unit, 'e>

Effect.race eff1 eff2

Full Usage: Effect.race eff1 eff2

Parameters:
Returns: Effect<'a, 'b, 'c>
Modifiers: inline

Races two effects against each other, returning the result of the winner.

eff1 : Effect<'a, 'b, 'c>

eff2 : Effect<'a, 'b, 'c>

Returns: Effect<'a, 'b, 'c>

Effect.recover f e

Full Usage: Effect.recover f e

Parameters:
    f : 'e -> 'a - The function to run in case of failure
    e : Effect<'r, 'a, 'e> - The effect

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'e, 'a, 'r

Recovers a failed effect by producing an in case of failure. If the effect was already successful, f is never run.

f : 'e -> 'a

The function to run in case of failure

e : Effect<'r, 'a, 'e>

The effect

Returns: Effect<'r, 'a, 'e>

Effect.resultJoin r

Full Usage: Effect.resultJoin r

Parameters:
    r : Result<Effect<'r, 'a, 'e>, 'e> - The result containing the effect

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Merges an outer result with its inner effect.

r : Result<Effect<'r, 'a, 'e>, 'e>

The result containing the effect

Returns: Effect<'r, 'a, 'e>

Effect.ret a

Full Usage: Effect.ret a

Parameters:
    a : 'a - The value to wrap in the effect

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Creates a new effect from a.

a : 'a

The value to wrap in the effect

Returns: Effect<'r, 'a, 'e>

Effect.retry e

Full Usage: Effect.retry e

Parameters:
Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e
e : Effect<'r, 'a, 'e>
Returns: Effect<'r, 'a, 'e>

Effect.retryIf cond e

Full Usage: Effect.retryIf cond e

Parameters:
    cond : 'e -> bool
    e : Effect<'r, 'a, 'e>

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'e, 'r, 'a
cond : 'e -> bool
e : Effect<'r, 'a, 'e>
Returns: Effect<'r, 'a, 'e>

Effect.retryTimes times e

Full Usage: Effect.retryTimes times e

Parameters:
    times : int
    e : Effect<'r, 'a, 'e>

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e
times : int
e : Effect<'r, 'a, 'e>
Returns: Effect<'r, 'a, 'e>

Effect.retryWhile cond e

Full Usage: Effect.retryWhile cond e

Parameters:
    cond : 'e -> bool
    e : Effect<'r, 'a, 'e>

Returns: Effect<'r, 'a, 'e>
cond : 'e -> bool
e : Effect<'r, 'a, 'e>
Returns: Effect<'r, 'a, 'e>

Effect.run env e

Full Usage: Effect.run env e

Parameters:
    env : 'r - The environment needed to start the effect
    e : Effect<'r, 'a, 'e> - The effect to run

Returns: AsyncResult<'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Starts the effect.

env : 'r

The environment needed to start the effect

e : Effect<'r, 'a, 'e>

The effect to run

Returns: AsyncResult<'a, 'e>

Effect.runOrFail env e

Full Usage: Effect.runOrFail env e

Parameters:
    env : 'r
    e : Effect<'r, 'a, 'e>

Returns: Task<'a>
Modifiers: inline
Type parameters: 'r, 'a, 'e
env : 'r
e : Effect<'r, 'a, 'e>
Returns: Task<'a>

Effect.sequence eff

Full Usage: Effect.sequence eff

Parameters:
    eff : Effect<'r, 'a, 'e> array

Returns: Effect<'r, 'a[], 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Sequences an array of effects, turning it in to an effect of an array. For a more generic implementation, consider FSharpPlus

eff : Effect<'r, 'a, 'e> array
Returns: Effect<'r, 'a[], 'e>

Effect.taskJoin t

Full Usage: Effect.taskJoin t

Parameters:
    t : Task<Effect<'r, 'a, 'e>> - The task containing the effect

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'r, 'a, 'e

Merges an outer task with its inner effect.

t : Task<Effect<'r, 'a, 'e>>

The task containing the effect

Returns: Effect<'r, 'a, 'e>

Effect.timeout ts onTimeout eff

Full Usage: Effect.timeout ts onTimeout eff

Parameters:
Returns: Effect<'b, 'c, 'a>
Modifiers: inline

Configures an effect to fail after a given amount of time, unless it has already succeeded. The original effect still executes.

ts : TimeSpan

onTimeout : 'a

eff : Effect<'b, 'c, 'a>

Returns: Effect<'b, 'c, 'a>

Effect.traverse f eff

Full Usage: Effect.traverse f eff

Parameters:
    f : 'a -> 'b
    eff : Effect<'r, 'a, 'e> array

Returns: Effect<'r, 'b[], 'e>
Modifiers: inline

Traverses an array of effects, turning it in to an effect of an array. For a more generic implementation, consider FSharpPlus

f : 'a -> 'b
eff : Effect<'r, 'a, 'e> array
Returns: Effect<'r, 'b[], 'e>

Effect.tryRecover f e

Full Usage: Effect.tryRecover f e

Parameters:
    f : 'e -> Result<'a, 'e> - The function to run in case of failure
    e : Effect<'r, 'a, 'e> - The effect

Returns: Effect<'r, 'a, 'e>
Modifiers: inline
Type parameters: 'e, 'a, 'r

Potentially recovers a failed effect by producing an Result{'a, 'e} in case of failure. If the effect was already successful, f is never run.

f : 'e -> Result<'a, 'e>

The function to run in case of failure

e : Effect<'r, 'a, 'e>

The effect

Returns: Effect<'r, 'a, 'e>

Effect.withCancellation ct eff

Full Usage: Effect.withCancellation ct eff

Parameters:
Returns: Effect<'a, unit, 'b>
ct : CancellationToken
eff : Effect<'a, unit, 'b>
Returns: Effect<'a, unit, 'b>

Effect.zip e1 e2 f

Full Usage: Effect.zip e1 e2 f

Parameters:
    e1 : Effect<'r, 'a, ^e> - The first effect.
    e2 : Effect<'r, 'b, ^e> - The second effect.
    f : 'a * 'b -> 'g - Function to combine the result of the effects in case both succeeds.

Returns: Effect<'r, 'g, ^e>
Modifiers: inline
Type parameters: 'r, 'a, ^e, 'b, 'g

Zips two effects together, the resulting effect will fail if either of the effects failed. In case both failed, the error is combined. The effects will execute in parallel if possible.

e1 : Effect<'r, 'a, ^e>

The first effect.

e2 : Effect<'r, 'b, ^e>

The second effect.

f : 'a * 'b -> 'g

Function to combine the result of the effects in case both succeeds.

Returns: Effect<'r, 'g, ^e>