Skip to content

execute

execute<S>(initialState): <A>(st) => S

Defined in: Core/State.ts:216

Runs a State computation with an initial state, returning only the final state (discarding the produced value).

S

S

<A>(st): S

A

State<S, A>

S

State.execute(0)(pipe(
  State.modify<number>(n => n + 10),
  State.chain(() => State.modify<number>(n => n * 2)),
)); // 20