Skip to content

run

run<W, A>(data): readonly [A, readonly W[]]

Defined in: Core/Logged.ts:144

Extracts the value and log as a readonly [A, ReadonlyArray<W>] tuple. Use this at the boundary where you need to consume both.

W

A

Logged<W, A>

readonly [A, readonly W[]]

const result = pipe(
  Logged.make<string, number>(1),
  Logged.chain(n => pipe(Logged.tell("incremented"), Logged.map(() => n + 1))),
);

const [value, log] = Logged.run(result);
// value = 2, log = ["incremented"]