StateT
public final class StateT<F, S, A> : StateTOf<F, S, A>StateT transformer represents operations that need to write and read a state through a computation or effect.
Some computations may not require the full power of this transformer:
    - For read-only state, see ReaderT / Kleisli.
    - To accumulate a value without using it on the way, see WriterT.
- 
                  
                  Safe downcast. DeclarationSwift public static func fix(_ fa: StateTOf<F, S, A>) -> StateT<F, S, A>ParametersfaValue in the higher-kind form. Return ValueValue cast to StateT. 
- 
                  
                  Initializes a StateT.DeclarationSwift public init(_ runF: @escaping (S) -> Kind<F, (S, A)>)ParametersrunFAn effect describing a function that receives a state and produces an effect that updates the state and productes a value. 
- 
                  
                  Generalizes this StateT to a parent state, given a lens to focus from the parent to the child state. DeclarationSwift func focus<SS>(_ lens: Lens<SS, S>) -> StateT<F, SS, A>ParameterslensA Lens to focus from the parent state into the child state. Return ValueAn StateTthat produces the same computation but updates the state in a parent state.
- 
                  
                  Initializes a Statevalue.DeclarationSwift convenience init(_ run: @escaping (S) -> (S, A))ParametersrunA function that depends on a state and produces a new state and a value. 
- 
                  
                  Runs this computation provided an initial state. DeclarationSwift func run(_ initialState: S) -> (S, A)ParametersinitialStateInitial state for this computation. Return ValueA pair with the updated state and the produced value. 
- 
                  
                  Runs this computation provided an initial state. DeclarationSwift func runA(_ s: S) -> AParameterssInitial state for this computation. Return ValueProduced value from this computation. 
- 
                  
                  Runs this computation provided an initial state. DeclarationSwift func runS(_ s: S) -> SParameterssInitial state for this computation. Return ValueUpdated state after running the computation. 
- 
                  
                  Transforms the return value and final state of a computation using a provided function. DeclarationSwift public func transform<B>(_ f: @escaping (S, A) -> (S, B)) -> StateT<F, S, B>ParametersfTransforming function. Return ValueAn StateTwhere the final state and produced value have been transformed using the provided function.
- 
                  
                  Transforms the wrapped value using a provided function. DeclarationParametersfTransforming function. Return ValueAn StateTwhere the final state and produced value have been transformed using the provided function.
- 
                  
                  Generalizes this StateT to a parent state, given functions to get and set the inner state into the general state. DeclarationSwift public func focus<SS>(_ getter: @escaping (SS) -> S, _ setter: @escaping (SS, S) -> SS) -> StateT<F, SS, A>ParametersgetterFunction to get the state from the parent. setterFunction to set the state into the parent. Return ValueAn StateTthat produces the same computation but updates the state in a parent state.
- 
                  
                  Runs this computation using the provided initial state. DeclarationSwift public func runA(_ s: S) -> Kind<F, A>ParameterssInitial state to run this computation. Return ValueResult of running this computation with the provided state, wrapped in the effect. 
- 
                  
                  Runs this computation using the provided initial state. DeclarationSwift public func runS(_ s: S) -> Kind<F, S>ParameterssInitial state to run this computation. Return ValueNew state after running this computation with the provided state, wrapped in the effect. 
- 
                  
                  Runs this computation using the provided initial state. DeclarationSwift public func runM(_ initial: S) -> Kind<F, (S, A)>ParametersinitialInitial state to run this computation. Return ValueA pair with the new state and produced value, wrapped in the effect. 
- 
                  
                  Modifies the state with a function and returns unit. DeclarationSwift public func modifyF(_ f: @escaping (S) -> Kind<F, S>) -> StateT<F, S, ()>ParametersfFunction to modify the state. Return ValueA StateT value with a modified state and unit as result value. 
- 
                  
                  Sets the state to a specific value and returns unit. DeclarationSwift public func setF(_ fs: Kind<F, S>) -> StateT<F, S, ()>ParametersfsValue to set the state. Return ValueA StateT value with a modified state and unit as result value. 
- 
                  
                  Flatmaps a function that produces an effect and lifts if back to StateT.DeclarationSwift public func semiflatMap<B>(_ f: @escaping (A) -> Kind<F, B>) -> StateT<F, S, B>ParametersfA function producing an effect. Return ValueResult of flatmapping and lifting the function to this value. 
 
             Install in Dash
              Install in Dash
             StateT Class Reference
        StateT Class Reference