Skip to content

bind

bind<K, S, A, B>(key, f): (data) => State<S, A & { [P in string]: B }>

Defined in: Core/State.ts:241

Evaluates a new State using the current accumulator and attaches the output to a new key.

K extends string

S

A

B

K

(a) => State<S, B>

(data) => State<S, A & { [P in string]: B }>

pipe(
  State.resolve({ a: 1 }),
  State.bind("b", ({ a }) => State.resolve(a + 1))
); // State({ a: 1, b: 2 })