| 1 | effect/Take#Take: |
| 2 | replacement: "Take.Take<A, E, Done>" |
| 3 | note: "v4 Take is the plain union NonEmptyReadonlyArray<A> | Exit.Exit<Done, E> — no wrapper object or Pipeable: a value batch is a non-empty array, a failure is a failed Exit, and end-of-stream is a successful Exit carrying the Done value (void by default). The module keeps the effect/Take path but exports only the type and toPull." |
| 4 | effect/Take#Take.Variance: |
| 5 | replacement: "none" |
| 6 | note: "Variance plumbing removed; v4 Take is a plain union type with no branded interface, so there is nothing to migrate to." |
| 7 | effect/Take#TakeTypeId: |
| 8 | replacement: "none" |
| 9 | note: "No brand symbol in v4; discriminate the union with Exit.isExit(take) (Exit branch) vs the non-empty array branch (Array.isReadonlyArrayNonEmpty)." |
| 10 | effect/Take#chunk: |
| 11 | replacement: "NonEmptyReadonlyArray" |
| 12 | note: "No constructor needed: a value-batch Take is just the non-empty array of values itself (convert a v3 Chunk with Array.fromIterable); empty batches are not representable and must be skipped." |
| 13 | effect/Take#dieMessage: |
| 14 | replacement: "Exit.die(new Error(message))" |
| 15 | note: "A defect Take is a died Exit; wrap the message in an Error yourself since there is no dedicated dieMessage helper." |
| 16 | effect/Take#done: |
| 17 | replacement: "Take.toPull" |
| 18 | note: "Take.toPull(take) converts a Take into a Pull (Effect succeeding with the batch); end-of-stream surfaces as Cause.Done in the error channel instead of v3's Option.none, and failures keep their cause." |
| 19 | effect/Take#fail: |
| 20 | replacement: "Exit.fail" |
| 21 | note: "A failing Take is simply the failed Exit: Exit.fail(error)." |
| 22 | effect/Take#failCause: |
| 23 | replacement: "Exit.failCause" |
| 24 | note: "A failing Take with a full cause is simply Exit.failCause(cause)." |
| 25 | effect/Take#fromEffect: |
| 26 | replacement: "Effect.exit + Exit.isSuccess" |
| 27 | note: "Run the effect with Effect.exit and convert the result: a successful exit value a becomes the single-element batch [a], a failed exit is used directly as the Take." |
| 28 | example: "Effect.map(Effect.exit(effect), (exit) => Exit.isSuccess(exit) ? [exit.value] as const : exit)" |
| 29 | effect/Take#fromExit: |
| 30 | replacement: "Exit.isSuccess(exit) ? [exit.value] : exit" |
| 31 | note: "A success exit becomes the single-element batch [a]; a failure exit is already a valid v4 Take and is used as-is." |
| 32 | effect/Take#fromPull: |
| 33 | replacement: "Effect.matchCause + Pull.doneExitFromCause" |
| 34 | note: "Convert one v4 Pull step into a Take: the success batch is the Take itself, and Pull.doneExitFromCause turns the failure cause into the Exit branch (Cause.Done becomes a successful end Exit, real failures become a failed Exit)." |
| 35 | example: "Effect.matchCause(pull, { onSuccess: (arr) => arr, onFailure: Pull.doneExitFromCause })" |
| 36 | effect/Take#isDone: |
| 37 | replacement: "Exit.isExit(take) && Exit.isSuccess(take)" |
| 38 | note: "End-of-stream is the successful-Exit branch of the union." |
| 39 | effect/Take#isFailure: |
| 40 | replacement: "Exit.isExit(take) && Exit.isFailure(take)" |
| 41 | note: "A failure Take is the failed-Exit branch of the union." |
| 42 | effect/Take#isSuccess: |
| 43 | replacement: "!Exit.isExit(take)" |
| 44 | note: "A value batch is the non-Exit branch; use Array.isReadonlyArrayNonEmpty(take) when a positive refinement to NonEmptyReadonlyArray<A> is needed." |
| 45 | effect/Take#make: |
| 46 | replacement: "none" |
| 47 | note: "No wrapper constructor: build the union value directly — a non-empty array for values, Exit.fail/Exit.failCause for errors, Exit.succeed(done) (or Exit.void) for end-of-stream; the v3 Exit<Chunk<A>, Option<E>> encoding is gone." |
| 48 | effect/Take#map: |
| 49 | replacement: "Exit.isExit(take) ? take : Array.map(take, f)" |
| 50 | note: "Only the value batch is mapped; effect's Array.map preserves the NonEmptyReadonlyArray type, and Exit branches (failure/end) pass through unchanged." |
| 51 | effect/Take#match: |
| 52 | replacement: "Exit.isExit + Exit.match" |
| 53 | note: "Branch on the union: the array branch is v3's onSuccess(chunk), and Exit.match splits the Exit branch into onFailure(cause) and end-of-stream (v3 onEnd, success value = Done)." |
| 54 | example: | |
| 55 | // v3: Take.match(take, { onEnd, onFailure, onSuccess }) |
| 56 | Exit.isExit(take) |
| 57 | ? Exit.match(take, { onSuccess: () => onEnd(), onFailure: (cause) => onFailure(cause) }) |
| 58 | : onSuccess(take) |
| 59 | effect/Take#matchEffect: |
| 60 | replacement: "Pull.matchEffect(Take.toPull(take), { onSuccess, onFailure, onDone })" |
| 61 | note: "Convert with Take.toPull and fold with Pull.matchEffect: onSuccess receives the batch (v3 onSuccess), onFailure the cause, onDone the completion value (v3 onEnd); alternatively branch manually with Exit.isExit as for match." |
| 62 | effect/Take#of: |
| 63 | replacement: "[value]" |
| 64 | note: "A single-value Take is just the one-element non-empty array literal." |
| 65 | effect/Take#tap: |
| 66 | replacement: "Exit.isExit(take) ? Exit.asVoid(take) : Effect.asVoid(f(take))" |
| 67 | note: "Peek at the value batch with f; Exit branches pass through as effects (a failed Exit re-propagates its cause, an end Exit becomes a void success), matching v3 tap semantics." |