Function lens

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), optic) applies an optic value (pure or complement-carrying), chaining if several are given.

      Type Parameters

      • P
      • R

      Parameters

      • parent: Read<P>
      • fwd: (v: P) => R
      • bwd: (target: R, v: P) => P

      Returns Writable<Cell<R>>

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs 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

      • parents: P
      • fwd: (vals: ReadValues<P>) => R
      • bwd: (target: R, vals: ReadValues<P>) => ReadValuesOrSkip<P>

      Returns Writable<Cell<R>>

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs 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

      • 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 }>

      Returns Writable<Cell<R>>

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), optic) applies an optic value (pure or complement-carrying), chaining if several are given.

      Type Parameters

      • P
      • V1

      Parameters

      • parent: Read<P>
      • optic: AppliedOptic<P, V1>

      Returns Writable<Cell<V1>>

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), optic) applies an optic value (pure or complement-carrying), chaining if several are given.

      Type Parameters

      • P
      • Os extends AnyOptics

      Parameters

      Returns Writable<Cell<ChainResult<P, Os>>>

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs 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>[]
      • V1

      Parameters

      • parents: P
      • optic: AppliedOptic<ReadValues<P>, V1>

      Returns Writable<Cell<V1>>

    • Untyped lens, inferring R from the closures or optic. A 2-arg bwd reads the source, a 1-arg bwd reconstructs 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

      Parameters

      • parents: P
      • ...optics: Os

      Returns Writable<Cell<ChainResult<ReadValues<P>, Os>>>