Skip to content

Logged

Logged<L, A> = WithValue<A> & WithLog<L>

Defined in: Core/Logged.ts:29

A value paired with an accumulated log.

Logged<L, A> pairs a result A with an immutable sequence of log entries L. When you sequence computations with chain, the logs are automatically concatenated in execution order without manual threading.

L

A

const program = pipe(
  Logged.make(0),
  Logged.chain(n => pipe(
    Logged.from.entry("start"),
    Logged.map(() => n + 1),
  )),
  Logged.chain(n => pipe(
    Logged.from.entry("done"),
    Logged.map(() => n * 10),
  )),
);

const [value, log] = Logged.to.Pair(program); // [10, ["start", "done"]]