/** * The state monad transformer. It can be used to add state to other monads. * * The `of` function leaves the state unchanged, while `chain` uses the final state of the first computation * as the initial state of the second. * * @since 2.0.0 */ import { Chain, Chain1, Chain2, Chain2C, Chain3, Chain3C } from './Chain.js'; import { Functor, Functor1, Functor2, Functor2C, Functor3, Functor3C } from './Functor.js'; import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from './HKT.js'; import { Monad, Monad1, Monad2, Monad2C, Monad3, Monad3C } from './Monad.js'; import { Pointed, Pointed1, Pointed2, Pointed2C, Pointed3, Pointed3C } from './Pointed.js'; import { State } from './State.js'; /** * @category model * @since 2.0.0 */ export interface StateT { (s: S): HKT; } /** * @category model * @since 2.0.0 */ export interface StateT1 { (s: S): Kind; } /** * @category model * @since 2.0.0 */ export interface StateT2 { (s: S): Kind2; } /** * @category model * @since 2.0.0 */ export interface StateT3 { (s: S): Kind3; } /** * @since 2.10.0 */ export declare function of(F: Pointed3): (a: A) => StateT3; export declare function of(F: Pointed3C): (a: A) => StateT3; export declare function of(F: Pointed2): (a: A) => StateT2; export declare function of(F: Pointed2C): (a: A) => StateT2; export declare function of(F: Pointed1): (a: A) => StateT1; export declare function of(F: Pointed): (a: A) => StateT; /** * @since 2.10.0 */ export declare function map(F: Functor3): (f: (a: A) => B) => (fa: StateT3) => StateT3; export declare function map(F: Functor3C): (f: (a: A) => B) => (fa: StateT3) => StateT3; export declare function map(F: Functor2): (f: (a: A) => B) => (fa: StateT2) => StateT2; export declare function map(F: Functor2C): (f: (a: A) => B) => (fa: StateT2) => StateT2; export declare function map(F: Functor1): (f: (a: A) => B) => (fa: StateT1) => StateT1; export declare function map(F: Functor): (f: (a: A) => B) => (fa: StateT) => StateT; /** * @since 2.10.0 */ export declare function ap(M: Chain3): (fa: StateT3) => (fab: StateT3 B>) => StateT3; export declare function ap(M: Chain3C): (fa: StateT3) => (fab: StateT3 B>) => StateT3; export declare function ap(M: Chain2): (fa: StateT2) => (fab: StateT2 B>) => StateT2; export declare function ap(M: Chain2C): (fa: StateT2) => (fab: StateT2 B>) => StateT2; export declare function ap(M: Chain1): (fa: StateT1) => (fab: StateT1 B>) => StateT1; export declare function ap(M: Chain): (fa: StateT) => (fab: StateT B>) => StateT; /** * @since 2.10.0 */ export declare function chain(M: Chain3): (f: (a: A) => StateT3) => (ma: StateT3) => StateT3; export declare function chain(M: Chain3C): (f: (a: A) => StateT3) => (ma: StateT3) => StateT3; export declare function chain(M: Chain2): (f: (a: A) => StateT2) => (ma: StateT2) => StateT2; export declare function chain(M: Chain2C): (f: (a: A) => StateT2) => (ma: StateT2) => StateT2; export declare function chain(M: Chain1): (f: (a: A) => StateT1) => (ma: StateT1) => StateT1; export declare function chain(M: Chain): (f: (a: A) => StateT) => (ma: StateT) => StateT; /** * @since 2.10.0 */ export declare function fromState(F: Pointed3): (sa: State) => StateT3; export declare function fromState(F: Pointed3C): (sa: State) => StateT3; export declare function fromState(F: Pointed2): (sa: State) => StateT2; export declare function fromState(F: Pointed2C): (sa: State) => StateT2; export declare function fromState(F: Pointed1): (sa: State) => StateT1; export declare function fromState(F: Pointed): (sa: State) => StateT; /** * @since 2.10.0 */ export declare function fromF(F: Functor3): (ma: Kind3) => StateT3; export declare function fromF(F: Functor3C): (ma: Kind3) => StateT3; export declare function fromF(F: Functor2): (ma: Kind2) => StateT2; export declare function fromF(F: Functor2C): (ma: Kind2) => StateT2; export declare function fromF(F: Functor1): (ma: Kind) => StateT1; export declare function fromF(F: Functor): (ma: HKT) => StateT; /** * @since 2.10.0 */ export declare function evaluate(F: Functor3): (s: S) => (ma: StateT3) => Kind3; export declare function evaluate(F: Functor3C): (s: S) => (ma: StateT3) => Kind3; export declare function evaluate(F: Functor2): (s: S) => (ma: StateT2) => Kind2; export declare function evaluate(F: Functor2C): (s: S) => (ma: StateT2) => Kind2; export declare function evaluate(F: Functor1): (s: S) => (ma: StateT1) => Kind; export declare function evaluate(F: Functor): (s: S) => (ma: StateT) => HKT; /** * @since 2.10.0 */ export declare function execute(F: Functor3): (s: S) => (ma: StateT3) => Kind3; export declare function execute(F: Functor3C): (s: S) => (ma: StateT3) => Kind3; export declare function execute(F: Functor2): (s: S) => (ma: StateT2) => Kind2; export declare function execute(F: Functor2C): (s: S) => (ma: StateT2) => Kind2; export declare function execute(F: Functor1): (s: S) => (ma: StateT1) => Kind; export declare function execute(F: Functor): (s: S) => (ma: StateT) => HKT; /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface StateM { readonly map: (fa: StateT, f: (a: A) => B) => StateT; readonly of: (a: A) => StateT; readonly ap: (fab: StateT B>, fa: StateT) => StateT; readonly chain: (fa: StateT, f: (a: A) => StateT) => StateT; readonly get: () => StateT; readonly put: (s: S) => StateT; readonly modify: (f: (s: S) => S) => StateT; readonly gets: (f: (s: S) => A) => StateT; readonly fromState: (fa: State) => StateT; readonly fromM: (ma: HKT) => StateT; readonly evalState: (ma: StateT, s: S) => HKT; readonly execState: (ma: StateT, s: S) => HKT; } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface StateM1 { readonly map: (fa: StateT1, f: (a: A) => B) => StateT1; readonly of: (a: A) => StateT1; readonly ap: (fab: StateT1 B>, fa: StateT1) => StateT1; readonly chain: (fa: StateT1, f: (a: A) => StateT1) => StateT1; readonly get: () => StateT1; readonly put: (s: S) => StateT1; readonly modify: (f: (s: S) => S) => StateT1; readonly gets: (f: (s: S) => A) => StateT1; readonly fromState: (fa: State) => StateT1; readonly fromM: (ma: Kind) => StateT1; readonly evalState: (ma: StateT1, s: S) => Kind; readonly execState: (ma: StateT1, s: S) => Kind; } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface StateM2 { readonly map: (fa: StateT2, f: (a: A) => B) => StateT2; readonly of: (a: A) => StateT2; readonly ap: (fab: StateT2 B>, fa: StateT2) => StateT2; readonly chain: (fa: StateT2, f: (a: A) => StateT2) => StateT2; readonly get: () => StateT2; readonly put: (s: S) => StateT2; readonly modify: (f: (s: S) => S) => StateT2; readonly gets: (f: (s: S) => A) => StateT2; readonly fromState: (fa: State) => StateT2; readonly fromM: (ma: Kind2) => StateT2; readonly evalState: (ma: StateT2, s: S) => Kind2; readonly execState: (ma: StateT2, s: S) => Kind2; } /** * @category zone of death * @since 2.5.4 * @deprecated */ export interface StateM2C { readonly map: (fa: StateT2, f: (a: A) => B) => StateT2; readonly of: (a: A) => StateT2; readonly ap: (fab: StateT2 B>, fa: StateT2) => StateT2; readonly chain: (fa: StateT2, f: (a: A) => StateT2) => StateT2; readonly get: () => StateT2; readonly put: (s: S) => StateT2; readonly modify: (f: (s: S) => S) => StateT2; readonly gets: (f: (s: S) => A) => StateT2; readonly fromState: (fa: State) => StateT2; readonly fromM: (ma: Kind2) => StateT2; readonly evalState: (ma: StateT2, s: S) => Kind2; readonly execState: (ma: StateT2, s: S) => Kind2; } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface StateM3 { readonly map: (fa: StateT3, f: (a: A) => B) => StateT3; readonly of: (a: A) => StateT3; readonly ap: (fab: StateT3 B>, fa: StateT3) => StateT3; readonly chain: (fa: StateT3, f: (a: A) => StateT3) => StateT3; readonly get: () => StateT3; readonly put: (s: S) => StateT3; readonly modify: (f: (s: S) => S) => StateT3; readonly gets: (f: (s: S) => A) => StateT3; readonly fromState: (fa: State) => StateT3; readonly fromM: (ma: Kind3) => StateT3; readonly evalState: (ma: StateT3, s: S) => Kind3; readonly execState: (ma: StateT3, s: S) => Kind3; } /** * @category zone of death * @since 2.5.4 * @deprecated */ export interface StateM3C { readonly map: (fa: StateT3, f: (a: A) => B) => StateT3; readonly of: (a: A) => StateT3; readonly ap: (fab: StateT3 B>, fa: StateT3) => StateT3; readonly chain: (fa: StateT3, f: (a: A) => StateT3) => StateT3; readonly get: () => StateT3; readonly put: (s: S) => StateT3; readonly modify: (f: (s: S) => S) => StateT3; readonly gets: (f: (s: S) => A) => StateT3; readonly fromState: (fa: State) => StateT3; readonly fromM: (ma: Kind3) => StateT3; readonly evalState: (ma: StateT3, s: S) => Kind3; readonly execState: (ma: StateT3, s: S) => Kind3; } /** * @category zone of death * @since 2.0.0 * @deprecated */ export declare function getStateM(M: Monad3): StateM3; /** @deprecated */ export declare function getStateM(M: Monad3C): StateM3C; /** @deprecated */ export declare function getStateM(M: Monad2): StateM2; /** @deprecated */ export declare function getStateM(M: Monad2C): StateM2C; /** @deprecated */ export declare function getStateM(M: Monad1): StateM1; /** @deprecated */ export declare function getStateM(M: Monad): StateM;