0.2.0 #5
@@ -34,6 +34,7 @@ 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> {
|
||||
readonly [LensStepTypeId]: LensStepTypeId
|
||||
readonly transform: (parent: B) => Effect.Effect<A, ER, RR>
|
||||
readonly transformStream: (parent: B) => Stream.Stream<A, ER, RR>
|
||||
readonly update: (next: A, parent: B) => Effect.Effect<B, EW, RW>
|
||||
}
|
||||
|
||||
@@ -52,18 +53,29 @@ export const isLensStep = (u: unknown): u is LensStep<unknown, unknown, unknown,
|
||||
export const LensImplTypeId: unique symbol = Symbol.for("@effect-fc/Lens/LensImpl")
|
||||
export type LensImplTypeId = typeof LensImplTypeId
|
||||
|
||||
export abstract class LensImpl<in out A, in out ER = never, in out EW = never, in out RR = never, in out RW = never>
|
||||
export abstract class LensImpl<
|
||||
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,
|
||||
>
|
||||
extends Pipeable.Class() implements Lens<A, ER, EW, RR, RW> {
|
||||
readonly [Readable.TypeId]: Readable.TypeId = Readable.TypeId
|
||||
readonly [Subscribable.TypeId]: Subscribable.TypeId = Subscribable.TypeId
|
||||
readonly [LensTypeId]: LensTypeId = LensTypeId
|
||||
readonly [LensImplTypeId]: LensImplTypeId = LensImplTypeId
|
||||
|
||||
readonly steps: readonly LensStep<A, ER, EW, RR, RW>[] = []
|
||||
readonly steps: readonly LensStep<B, SER, SEW, SRR, SRW>[] = []
|
||||
|
||||
abstract readonly sourceGet: Effect.Effect<A, ER, RR>
|
||||
abstract readonly sourceChanges: Stream.Stream<A, ER, RR>
|
||||
abstract readonly sourceCommit: (a: A) => Effect.Effect<void, EW, RW>
|
||||
abstract readonly sourceGet: Effect.Effect<B, SourceER, SourceRR>
|
||||
abstract readonly sourceChanges: Stream.Stream<B, SourceER, SourceRR>
|
||||
abstract readonly sourceCommit: (b: B) => Effect.Effect<void, SourceEW, SourceRW>
|
||||
abstract readonly withLock: <A1, E1, R1>(self: Effect.Effect<A1, E1, R1>) => Effect.Effect<A1, EW | E1, RW | R1>
|
||||
|
||||
get get(): Effect.Effect<A, ER, RR> {
|
||||
|
||||
Reference in New Issue
Block a user