Skip to content

chain

chain<W, A, B>(f): (data) => Logged<W, B>

Defined in: Core/Logged.ts:86

Sequences two Logged computations, concatenating their logs. The value from the first is passed to f; the resulting log entries are appended after the entries from the first.

Data-last — the first computation is the data being piped.

W

A

B

(a) => Logged<W, B>

(data): Logged<W, B>

Logged<W, A>

Logged<W, B>

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

Logged.run(result); // [20, ["step", "done"]]