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>>Untyped lens, inferring
Rfrom the closures or optic. A 2-argbwdreads the source, a 1-argbwdreconstructs it;lens(parent(s), optic)applies an optic value (pure or complement-carrying), chaining if several are given.Type Parameters
- P extends readonly Read<unknown>[]
- R
Parameters
Returns 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>>Untyped lens, inferring
Rfrom the closures or optic. A 2-argbwdreads the source, a 1-argbwdreconstructs it;lens(parent(s), optic)applies an optic value (pure or complement-carrying), chaining if several are given.Type Parameters
- S extends Record<string, Read<unknown>>
- R
Parameters
Returns Writable<Cell<R>>
- lens<P extends readonly Read<unknown>[], V1>(
parents: P,
optic: AppliedOptic<ReadValues<P>, V1>,
): Writable<Cell<V1>> - lens<P extends readonly Read<unknown>[], Os extends AnyOptics>(
parents: P,
...optics: Os,
): Writable<Cell<ChainResult<ReadValues<P>, Os>>>Untyped lens, inferring
Rfrom the closures or optic. A 2-argbwdreads the source, a 1-argbwdreconstructs it;lens(parent(s), optic)applies an optic value (pure or complement-carrying), chaining if several are given.Type Parameters
- P extends readonly Read<unknown>[]
- Os extends AnyOptics
Returns Writable<Cell<ChainResult<ReadValues<P>, Os>>>
Untyped lens, inferring
Rfrom the closures or optic. A 2-argbwdreads the source, a 1-argbwdreconstructs it;lens(parent(s), optic)applies an optic value (pure or complement-carrying), chaining if several are given.