FSharpPlus


State Module

Basic operations on State

Functions and values

Function or value Description

State.apply arg1 arg2

Full Usage: State.apply arg1 arg2

Parameters:
    arg0 : State<'S, ('T -> 'U)>
    arg1 : State<'S, 'T>

Returns: State<'S, 'U>
arg0 : State<'S, ('T -> 'U)>
arg1 : State<'S, 'T>
Returns: State<'S, 'U>

State.bind f arg2

Full Usage: State.bind f arg2

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

State.eval arg1 s

Full Usage: State.eval arg1 s

Parameters:
    arg0 : State<'s, 'T>
    s : 's

Returns: 'T

Evaluates a state computation with the initial value and return only the result value of the computation. Ignore the final state.

arg0 : State<'s, 'T>
s : 's
Returns: 'T

State.exec arg1 s

Full Usage: State.exec arg1 s

Parameters:
    arg0 : State<'S, 'A>
    s : 'S

Returns: 'S

Evaluates a state computation with the initial value and return only the final state of the computation. Ignore the result value.

arg0 : State<'S, 'A>
s : 'S
Returns: 'S

State.get

Full Usage: State.get

Returns: State<'S, 'S>

Return the state from the internals of the monad.

Returns: State<'S, 'S>

State.gets f

Full Usage: State.gets f

Parameters:
    f : 'S -> 'T

Returns: State<'S, 'T>

Get a value which depends on the current state.

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

State.map f arg2

Full Usage: State.map f arg2

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

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

State.map2 f arg2 arg3

Full Usage: State.map2 f arg2 arg3

Parameters:
    f : 'T -> 'U -> 'V
    arg1 : State<'S, 'T>
    arg2 : State<'S, 'U>

Returns: State<'S, 'V>

Combines two States into one by applying a mapping function.

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

State.map3 f arg2 arg3 arg4

Full Usage: State.map3 f arg2 arg3 arg4

Parameters:
    f : 'T -> 'U -> 'V -> 'W
    arg1 : State<'S, 'T>
    arg2 : State<'S, 'U>
    arg3 : State<'S, 'V>

Returns: State<'S, 'W>

Combines three States into one by applying a mapping function.

f : 'T -> 'U -> 'V -> 'W
arg1 : State<'S, 'T>
arg2 : State<'S, 'U>
arg3 : State<'S, 'V>
Returns: State<'S, 'W>

State.modify f

Full Usage: State.modify f

Parameters:
    f : 'S -> 'S

Returns: State<'S, unit>

Modify the state inside the monad by applying a function.

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

State.put x

Full Usage: State.put x

Parameters:
    x : 'S

Returns: State<'S, unit>

Replace the state inside the monad.

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

State.run arg1

Full Usage: State.run arg1

Parameters:
Returns: 'S -> 'T * 'S

Runs the state with an inital state to get back the result and the new state.

arg0 : State<'S, 'T>
Returns: 'S -> 'T * 'S

State.zip x y

Full Usage: State.zip x y

Parameters:
Returns: State<'S, ('T * 'U)>

Zips two States into one.

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