Logged
Logged:
object
Defined in: Core/Logged.ts:29
Type Declaration
Section titled “Type Declaration”ap: <
W,A>(arg) => <B>(data) =>Logged<W,B>
Applies a function wrapped in a Logged to a value wrapped in a Logged,
concatenating both logs.
Type Parameters
Section titled “Type Parameters”W
A
Parameters
Section titled “Parameters”Logged<W, A>
Returns
Section titled “Returns”<B>(data) => Logged<W, B>
Example
Section titled “Example”bind: <
K,W,A,B>(key,f) => (data) =>Logged<W,A&{ [P in string]: B }>
Evaluates a new Logged using the current accumulator and attaches the output to a new key.
Type Parameters
Section titled “Type Parameters”K extends string
W
A
B
Parameters
Section titled “Parameters”K
(a) => Logged<W, B>
Returns
Section titled “Returns”(data) => Logged<W, A & { [P in string]: B }>
Example
Section titled “Example”bindTo
Section titled “bindTo”bindTo: <
K>(key) => <W,A>(data) =>Logged<W,{ [P in string]: A }>
Lifts a Logged value into an accumulator object.
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”<W, A>(data) => Logged<W, { [P in string]: A }>
Example
Section titled “Example”chain: <
W,A,B>(f) => (data) =>Logged<W,B> =chainLogged
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.
Type Parameters
Section titled “Type Parameters”W
A
B
Parameters
Section titled “Parameters”(a) => Logged<W, B>
Returns
Section titled “Returns”(data) => Logged<W, B>
Example
Section titled “Example”focus: <
S,A>(lens) => <W>(f) => (data) =>Logged<W,S>
Focuses a Logged computation’s value transformation using a Lens.
Type Parameters
Section titled “Type Parameters”S
A
Parameters
Section titled “Parameters”Lens<S, A>
Returns
Section titled “Returns”<W>(f) => (data) => Logged<W, S>
Example
Section titled “Example”from:
object
from.entry
Section titled “from.entry”entry: <
W>(logEntry) =>Logged<W,undefined> =makeEntry
Creates a Logged that records a single log entry and produces no
meaningful value. Use this to append to the log inside a chain.
Type Parameters
Section titled “Type Parameters”W
Parameters
Section titled “Parameters”logEntry
Section titled “logEntry”W
Returns
Section titled “Returns”Logged<W, undefined>
Example
Section titled “Example”from.value
Section titled “from.value”value: <
W,A>(val) =>Logged<W,A> =makeValue
Wraps a pure value into a Logged with an empty log.
Type Parameters
Section titled “Type Parameters”W
A
Parameters
Section titled “Parameters”A
Returns
Section titled “Returns”Logged<W, A>
Example
Section titled “Example”map: <
W,A,B>(f) => (data) =>Logged<W,B> =mapLogged
Transforms the value inside a Logged without affecting the log.
Type Parameters
Section titled “Type Parameters”W
A
B
Parameters
Section titled “Parameters”(a) => B
Returns
Section titled “Returns”(data) => Logged<W, B>
Example
Section titled “Example”run: <
W,A>(data) => readonly [A, readonlyW[]]
Extracts the value and log as a readonly [A, ReadonlyArray<W>] tuple.
Use this at the boundary where you need to consume both.
Type Parameters
Section titled “Type Parameters”W
A
Parameters
Section titled “Parameters”Logged<W, A>
Returns
Section titled “Returns”readonly [A, readonly W[]]
Example
Section titled “Example”tap: <
W,A>(f) => (data) =>Logged<W,A>
Runs a side effect on the value without changing the Logged.
Useful for debugging or inspecting intermediate values.
Type Parameters
Section titled “Type Parameters”W
A
Parameters
Section titled “Parameters”(a) => void
Returns
Section titled “Returns”(data) => Logged<W, A>