@@ -31,11 +31,22 @@ export const isLens = (u: unknown): u is Lens<unknown, unknown, unknown, unknown
|
|||||||
export const LensStepTypeId: unique symbol = Symbol.for("@effect-fc/Lens/LensStep")
|
export const LensStepTypeId: unique symbol = Symbol.for("@effect-fc/Lens/LensStep")
|
||||||
export type LensStepTypeId = typeof LensTypeId
|
export type LensStepTypeId = typeof LensTypeId
|
||||||
|
|
||||||
export interface LensStep<in out A, in out B, in out ER = never, in out EW = never, in out RR = never, in out RW = never> {
|
export interface LensStep<
|
||||||
|
in out A,
|
||||||
|
in out B,
|
||||||
|
in out ER = never,
|
||||||
|
in out EW = never,
|
||||||
|
in out RR = never,
|
||||||
|
in out RW = never,
|
||||||
|
in out SourceER = never,
|
||||||
|
in out SourceEW = never,
|
||||||
|
in out SourceRR = never,
|
||||||
|
in out SourceRW = never,
|
||||||
|
> {
|
||||||
readonly [LensStepTypeId]: LensStepTypeId
|
readonly [LensStepTypeId]: LensStepTypeId
|
||||||
readonly transform: (parent: B) => Effect.Effect<A, ER, RR>
|
readonly transform: (effect: Effect.Effect<B, SourceER, SourceRR>) => Effect.Effect<A, ER, RR>
|
||||||
readonly transformStream: (parent: B) => Stream.Stream<A, ER, RR>
|
readonly transformStream: (stream: Stream.Stream<B, SourceER, SourceRR>) => Stream.Stream<A, ER, RR>
|
||||||
readonly update: (next: A, parent: B) => Effect.Effect<B, EW, RW>
|
readonly update: (next: Effect.Effect<A, SourceEW, SourceRW>, parent: B) => Effect.Effect<B, EW, RW>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isLensStep = (u: unknown): u is LensStep<unknown, unknown, unknown, unknown, unknown, unknown> => Predicate.hasProperty(u, LensStepTypeId)
|
export const isLensStep = (u: unknown): u is LensStep<unknown, unknown, unknown, unknown, unknown, unknown> => Predicate.hasProperty(u, LensStepTypeId)
|
||||||
@@ -71,7 +82,7 @@ extends Pipeable.Class() implements Lens<A, ER, EW, RR, RW> {
|
|||||||
readonly [LensTypeId]: LensTypeId = LensTypeId
|
readonly [LensTypeId]: LensTypeId = LensTypeId
|
||||||
readonly [LensImplTypeId]: LensImplTypeId = LensImplTypeId
|
readonly [LensImplTypeId]: LensImplTypeId = LensImplTypeId
|
||||||
|
|
||||||
readonly steps: readonly LensStep<B, SER, SEW, SRR, SRW>[] = []
|
readonly steps: readonly LensStep<A, B, ER, EW, RR, RW, SourceER, SourceEW, SourceRR, SourceRW>[] = []
|
||||||
|
|
||||||
abstract readonly sourceGet: Effect.Effect<B, SourceER, SourceRR>
|
abstract readonly sourceGet: Effect.Effect<B, SourceER, SourceRR>
|
||||||
abstract readonly sourceChanges: Stream.Stream<B, SourceER, SourceRR>
|
abstract readonly sourceChanges: Stream.Stream<B, SourceER, SourceRR>
|
||||||
|
|||||||
Reference in New Issue
Block a user