Function lens
- lens<P extends readonly Read<unknown>[], R>(
parents: P,
fwd: (vals: ReadValues<P>) => R,
bwd: (target: R, vals: ReadValues<P>) => ReadValuesOrSkip<P>,
): Writable<Cell<R>> - lens<S extends Record<string, Read<unknown>>, R>(
parents: S,
fwd: (vals: { [K in string | number | symbol]: Inner<S[K]> }) => R,
bwd: (
target: R,
vals: { [K in string | number | symbol]: Inner<S[K]> },
) => Partial<{ [K in keyof S]: Inner<S[K]> | Skip }>,
): Writable<Cell<R>> - lens<P extends readonly Read<unknown>[], R, C>(
parents: P,
spec: StatefulLensSpec<ReadValues<P>, R, C>,
): Writable<Cell<R>>Untyped lens, inferring
Rfrom the closures. A 2-argbwdreads the source, a 1-argbwdreconstructs it;lens(parent(s), spec)builds a complement-carrying lens.Type Parameters
- P extends readonly Read<unknown>[]
- R
- C
Parameters
- parents: P
- spec: StatefulLensSpec<ReadValues<P>, R, C>
Returns Writable<Cell<R>>
Untyped lens, inferring
Rfrom the closures. A 2-argbwdreads the source, a 1-argbwdreconstructs it;lens(parent(s), spec)builds a complement-carrying lens.