FSharpPlus


State<'s, 't> Type

Computation type: Computations which maintain state.

Binding strategy: Threads a state parameter through the sequence of bound functions so that the same state value is never used twice, giving the illusion of in-place update.

Useful for: Building computations from sequences of operations that require a shared state.

The indicates the computation state, while indicates the result.

Table of contents

Functor

Static members

Static member Description

f <!> x

Full Usage: f <!> x

Parameters:
    f : 'T -> 'U
    x : State<'S, 'T>

Returns: State<'S, 'U>

Lifts a function into a State. Same as map. To be used in Applicative Style expressions, combined with <*>

f : 'T -> 'U
x : State<'S, 'T>
Returns: State<'S, 'U>

Applicative

Static members

Static member Description

x *> y

Full Usage: x *> y

Parameters:
Returns: State<'S, 'U>

Sequences two States left-to-right, discarding the value of the first argument.

x : State<'S, 'T>
y : State<'S, 'U>
Returns: State<'S, 'U>

x <* y

Full Usage: x <* y

Parameters:
Returns: State<'S, 'U>

Sequences two States left-to-right, discarding the value of the second argument.

x : State<'S, 'U>
y : State<'S, 'T>
Returns: State<'S, 'U>

Monad

Static members

Static member Description

f >=> g

Full Usage: f >=> g

Parameters:
Returns: 'T -> State<'S, 'V>

Composes left-to-right two State functions (Kleisli composition).

f : 'T -> State<'S, 'U>
g : 'U -> State<'S, 'V>
Returns: 'T -> State<'S, 'V>

Other module members

Union cases

Union case Description

State 's -> 't * 's

Full Usage: State 's -> 't * 's

Parameters:
    Item : 's -> 't * 's

Item : 's -> 't * 's

Static members

Static member Description

f <*> x

Full Usage: f <*> x

Parameters:
Returns: State<'S, 'U>
f : State<'S, ('T -> 'U)>
x : State<'S, 'T>
Returns: State<'S, 'U>

x >>= f

Full Usage: x >>= f

Parameters:
Returns: State<'S, 'U>
x : State<'S, 'T>
f : 'T -> State<'S, 'U>
Returns: State<'S, 'U>

State.Delay(body)

Full Usage: State.Delay(body)

Parameters:
    body : unit -> State<'S, 'T>

Returns: State<'S, 'T>
body : unit -> State<'S, 'T>
Returns: State<'S, 'T>

State.Lift2(f, x, y)

Full Usage: State.Lift2(f, x, y)

Parameters:
    f : 'T -> 'U -> 'V
    x : State<'S, 'T>
    y : State<'S, 'U>

Returns: State<'S, 'V>
f : 'T -> 'U -> 'V
x : State<'S, 'T>
y : State<'S, 'U>
Returns: State<'S, 'V>

State.Lift3(f, x, y, z)

Full Usage: State.Lift3(f, x, y, z)

Parameters:
    f : 'T -> 'U -> 'V -> 'W
    x : State<'S, 'T>
    y : State<'S, 'U>
    z : State<'S, 'V>

Returns: State<'S, 'W>
f : 'T -> 'U -> 'V -> 'W
x : State<'S, 'T>
y : State<'S, 'U>
z : State<'S, 'V>
Returns: State<'S, 'W>

State.Map(x, f)

Full Usage: State.Map(x, f)

Parameters:
    x : State<'S, 'T>
    f : 'T -> 'U

Returns: State<'S, 'U>
x : State<'S, 'T>
f : 'T -> 'U
Returns: State<'S, 'U>

State.Put(x)

Full Usage: State.Put(x)

Parameters:
    x : 'S

Returns: State<'S, unit>
x : 'S
Returns: State<'S, unit>

State.Return(a)

Full Usage: State.Return(a)

Parameters:
    a : 'T

Returns: State<'S, 'T>
a : 'T
Returns: State<'S, 'T>

State.TryFinally(arg1, f)

Full Usage: State.TryFinally(arg1, f)

Parameters:
    arg0 : State<'S, 'T>
    f : unit -> unit

Returns: State<'S, 'T>
arg0 : State<'S, 'T>
f : unit -> unit
Returns: State<'S, 'T>

State.TryWith(arg1, h)

Full Usage: State.TryWith(arg1, h)

Parameters:
Returns: State<'S, 'T>
arg0 : State<'S, 'T>
h : exn -> State<'S, 'T>
Returns: State<'S, 'T>

State.Using(resource, f)

Full Usage: State.Using(resource, f)

Parameters:
    resource : 'a
    f : 'a -> State<'S, 'T>

Returns: State<'S, 'T>
resource : 'a
f : 'a -> State<'S, 'T>
Returns: State<'S, 'T>

State.Zip(x, y)

Full Usage: State.Zip(x, y)

Parameters:
Returns: State<'a, ('b * 'c)>
x : State<'a, 'b>
y : State<'a, 'c>
Returns: State<'a, ('b * 'c)>

State.get_Get ()

Full Usage: State.get_Get ()

Returns: State<'S, 'S>
Returns: State<'S, 'S>