Class Flags<K>
Type Parameters
- K extends string
Hierarchy
- Cell<number>
- Flags (View Summary)
Methods
derive
Parameters
- this: Cell<number>
- fn: (v: number) => number
Returns this
flag
lens
- lens(
this: Cell<number>,
fwd: (v: number) => number,
bwd: (target: number, current: number) => number,
): thisEndomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Parameters
- this: Cell<number>
- fwd: (v: number) => number
- bwd: (target: number, current: number) => number
Returns this
Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Parameters
- this: Cell<number>
- ...optics: readonly AppliedOptic<number, number>[]
Returns this
Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Type Parameters
- V1
Returns Writable<Cell<V1>>
- lens<Os extends AnyOptics>(
this: Cell<number>,
...optics: Os,
): Writable<Cell<ChainResult<number, Os>>>Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Type Parameters
- Os extends AnyOptics
Returns Writable<Cell<ChainResult<number, Os>>>
merge
peek
Returns number
Staticcoerce
Staticderive
Staticis
Staticlens
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
fwd: (v: P) => Inner<InstanceType<C>>,
bwd: (target: Inner<InstanceType<C>>, v: P) => P,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
fwd: (vals: ReadValues<P>) => Inner<InstanceType<C>>,
bwd: (
target: Inner<InstanceType<C>>,
vals: ReadValues<P>,
) => BackUpdates<ReadValuesOrSkip<P>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
optic: AppliedOptic<P, Inner<InstanceType<C>>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
optic: AppliedOptic<ReadValues<P>, Inner<InstanceType<C>>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P, Os extends AnyOptics>(
this: C,
parent: Read<P>,
...optics: Os,
): ChainResult<P, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: neverWritable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
- Os extends AnyOptics
Returns ChainResult<P, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: never - lens<
C extends AnyCellCtor,
P extends readonly Read<unknown>[],
Os extends AnyOptics,
>(
this: C,
parents: P,
...optics: Os,
): ChainResult<ReadValues<P>, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: neverWritable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
- Os extends AnyOptics
Returns ChainResult<ReadValues<P>, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: never
Read-only same-type view: the RO dual of the endo
.lens. For a cross-type view use the typed staticTarget.derive(src, fn).