 # StateT

`@higherkind class StateT<S, F, A>`

`StateT<S, F, A>` is a stateful computation within a context `F` yielding a value of type `A`. i.e. StateT<S, EitherPartialOf, A> = Either<E, State<S, A>>

### Parameters

`F` - the context that wraps the stateful computation.

`S` - the state we are performing computation upon.

`A` - current value of computation.

`runF` - the stateful computation that is wrapped and managed by `StateT`

### Properties

 runF the stateful computation that is wrapped and managed by `StateT``val runF: ``StateTFun```

### Functions

 ap Apply a function `(S) -> B` that operates within the StateT context.`fun ap(MF: Monad, ff: B>): ``StateT``` combineK Combine two StateT objects using an instance of SemigroupK for F.`fun combineK(SF: SemigroupK, y: ): ``StateT``` flatMap Map the value A to another StateT object for the same state S and context F and flatten the structure.`fun flatMap(MF: Monad, fas: (A) -> ): ``StateT``` flatMapF Map the value A to a arbitrary type B that is within the context of F.`fun flatMapF(MF: Monad, faf: (A) -> Kind): ``StateT``` map Map current value A given a function f.`fun map(FF: Functor, f: (A) -> B): ``StateT``` runA Run the stateful computation within the context `F` and get the value A.`fun runA(MF: Monad, s: S): Kind` runS Run the stateful computation within the context `F` and get the state S.`fun runS(MF: Monad, s: S): Kind` transform Transform the product of state S and value A to an another product of state S and an arbitrary type B.`fun transform(FF: Functor, f: (Tuple2) -> Tuple2): ``StateT```

### Companion Object Functions

 get Return input without modifying it.`fun get(AF: Applicative): ``StateT``` inspect Inspect a value of the state S with f `(S) -> T` without modifying the state.`fun inspect(AF: Applicative, f: (S) -> T): ``StateT``` invoke `operator fun invoke(f: (S) -> Kind>): ``StateT``` just `fun just(AF: Applicative, t: T): ``StateT``` liftF Lift a value of type `Kind` into `StateT`.`fun liftF(AF: Applicative, fa: Kind): ``StateT``` modify Modify the state with f `(S) -> S` and return Unit.`fun modify(AF: Applicative, f: (S) -> S): ``StateT``` modifyF Modify the state with an Applicative function f `(S) -> Kind` and return Unit.`fun modifyF(AF: Applicative, f: (S) -> Kind): ``StateT``` set Set the state to a value s and return Unit.`fun set(AF: Applicative, s: S): ``StateT``` setF Set the state to a value s of type `Kind` and return Unit.`fun setF(AF: Applicative, s: Kind): ``StateT``` tailRecM Tail recursive function that keeps calling f until arrow.Either.Right is returned.`fun tailRecM(MF: Monad, a: A, f: (A) -> >): ``StateT```

### Extension Functions

 flatMap `fun ``State``.flatMap(f: (A) -> ``State``): ``State``` map `fun ``State``.map(sx: ``State``, f: (T, P1) -> R): ``State````fun ``State``.map(f: (T) -> R): ``State``` run `fun ``State``.run(initial: S): Tuple2` runA Alias for StateT.runA `StateT``fun ``StateT``.runA(initial: S): A` runS Alias for StateT.runS `StateT``fun ``StateT``.runS(initial: S): S`

Do you like Arrow?

<