Skip to content

ap

ap<W, A>(arg): <B>(data) => Logged<W, B>

Defined in: Core/Logged.ts:107

Applies a function wrapped in a Logged to a value wrapped in a Logged, concatenating both logs.

W

A

Logged<W, A>

<B>(data): Logged<W, B>

B

Logged<W, (a) => B>

Logged<W, B>

const fn: Logged<string, (n: number) => number> = {
  value: n => n * 2,
  log: ["fn-loaded"],
};
const arg: Logged<string, number> = { value: 5, log: ["arg-loaded"] };

const result = pipe(fn, Logged.ap(arg));
Logged.run(result); // [10, ["fn-loaded", "arg-loaded"]]