(n: number, ref: Ref.Ref<number>)
| 75 | return pipe(incLeft(n - 1, ref), Effect.zipLeft(Ref.update(ref, (n) => n + 1))) |
| 76 | } |
| 77 | const incRight = (n: number, ref: Ref.Ref<number>): Effect.Effect<number> => { |
| 78 | if (n <= 0) { |
| 79 | return Ref.get(ref) |
| 80 | } |
| 81 | return pipe(Ref.update(ref, (n) => n + 1), Effect.zipRight(incRight(n - 1, ref))) |
| 82 | } |
| 83 | const left = pipe(Ref.make(0), Effect.flatMap((ref) => incLeft(100, ref)), Effect.map((n) => n === 0)) |
| 84 | const right = pipe(Ref.make(0), Effect.flatMap((ref) => incRight(1000, ref)), Effect.map((n) => n === 1000)) |
| 85 | const result = yield* pipe(left, Effect.zipWith(right, (a, b) => a && b)) |
no test coverage detected