Function lens

    • Untyped lens, inferring R from the closures. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), spec) builds a complement-carrying lens.

      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. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), spec) builds a complement-carrying lens.

      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. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), spec) builds a complement-carrying lens.

      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. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), spec) builds a complement-carrying lens.

      Type Parameters

      • P
      • R
      • C

      Parameters

      Returns Writable<Cell<R>>

    • Untyped lens, inferring R from the closures. A 2-arg bwd reads the source, a 1-arg bwd reconstructs it; lens(parent(s), spec) builds a complement-carrying lens.

      Type Parameters

      • P extends readonly Read<unknown>[]
      • R
      • C

      Parameters

      Returns Writable<Cell<R>>