State

public class State<S, A> : StateOf<S, A>

State is a convenience data type over the StateT transformer, when the effect is Id.

  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ value: StateOf<S, A>) -> State<S, A>

    Parameters

    value

    Value in the higher-kind form.

    Return Value

    Value cast to State.

  • Initializes a State value.

    Declaration

    Swift

    public init(_ run: @escaping (S) -> (S, A))

    Parameters

    run

    A function that depends on a state and produces a new state and a value.