0.2.0 #5
@@ -91,17 +91,15 @@ extends Pipeable.Class() implements Lens<A, ER, EW, RR, RW> {
|
||||
|
||||
get get(): Effect.Effect<A, ER, RR> {
|
||||
let effect: Effect.Effect<unknown, unknown, unknown> = this.sourceGet
|
||||
for (const step of this.steps) {
|
||||
for (const step of this.steps)
|
||||
effect = step.transform(effect as never)
|
||||
}
|
||||
return effect as Effect.Effect<A, ER, RR>
|
||||
}
|
||||
|
||||
get changes(): Stream.Stream<A, ER, RR> {
|
||||
let stream: Stream.Stream<unknown, unknown, unknown> = this.sourceChanges
|
||||
for (const step of this.steps) {
|
||||
for (const step of this.steps)
|
||||
stream = step.transformStream(stream as never)
|
||||
}
|
||||
return stream as Stream.Stream<A, ER, RR>
|
||||
}
|
||||
|
||||
@@ -114,12 +112,11 @@ extends Pipeable.Class() implements Lens<A, ER, EW, RR, RW> {
|
||||
const parents: unknown[] = []
|
||||
let current: Effect.Effect<unknown, unknown, unknown> = Effect.succeed(source)
|
||||
|
||||
for (const step of this.steps) {
|
||||
for (const step of this.steps)
|
||||
current = Effect.flatMap(current, parent => {
|
||||
parents.push(parent)
|
||||
return step.transform(Effect.succeed(parent) as never)
|
||||
})
|
||||
}
|
||||
|
||||
return Effect.flatMap(current, a => Effect.flatMap(
|
||||
f(a as A),
|
||||
@@ -127,7 +124,9 @@ extends Pipeable.Class() implements Lens<A, ER, EW, RR, RW> {
|
||||
let rebuilt: Effect.Effect<unknown, unknown, unknown> = Effect.succeed(next)
|
||||
|
||||
for (let i = this.steps.length - 1; i >= 0; i--) {
|
||||
// biome-ignore lint/style/noNonNullAssertion: won't throw
|
||||
const step = this.steps[i]!
|
||||
// biome-ignore lint/style/noNonNullAssertion: won't throw
|
||||
const parent = parents[i]!
|
||||
rebuilt = step.update(rebuilt as never, parent as never)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user