mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-13 05:47:44 +02:00
67 lines
4.8 KiB
YAML
67 lines
4.8 KiB
YAML
effect/Take#Take:
|
|
replacement: "Take.Take<A, E, Done>"
|
|
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."
|
|
effect/Take#Take.Variance:
|
|
replacement: "none"
|
|
note: "Variance plumbing removed; v4 Take is a plain union type with no branded interface, so there is nothing to migrate to."
|
|
effect/Take#TakeTypeId:
|
|
replacement: "none"
|
|
note: "No brand symbol in v4; discriminate the union with Exit.isExit(take) (Exit branch) vs the non-empty array branch (Array.isReadonlyArrayNonEmpty)."
|
|
effect/Take#chunk:
|
|
replacement: "NonEmptyReadonlyArray"
|
|
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."
|
|
effect/Take#dieMessage:
|
|
replacement: "Exit.die(new Error(message))"
|
|
note: "A defect Take is a died Exit; wrap the message in an Error yourself since there is no dedicated dieMessage helper."
|
|
effect/Take#done:
|
|
replacement: "Take.toPull"
|
|
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."
|
|
effect/Take#fail:
|
|
replacement: "Exit.fail"
|
|
note: "A failing Take is simply the failed Exit: Exit.fail(error)."
|
|
effect/Take#failCause:
|
|
replacement: "Exit.failCause"
|
|
note: "A failing Take with a full cause is simply Exit.failCause(cause)."
|
|
effect/Take#fromEffect:
|
|
replacement: "Effect.exit + Exit.isSuccess"
|
|
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."
|
|
example: "Effect.map(Effect.exit(effect), (exit) => Exit.isSuccess(exit) ? [exit.value] as const : exit)"
|
|
effect/Take#fromExit:
|
|
replacement: "Exit.isSuccess(exit) ? [exit.value] : exit"
|
|
note: "A success exit becomes the single-element batch [a]; a failure exit is already a valid v4 Take and is used as-is."
|
|
effect/Take#fromPull:
|
|
replacement: "Effect.matchCause + Pull.doneExitFromCause"
|
|
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)."
|
|
example: "Effect.matchCause(pull, { onSuccess: (arr) => arr, onFailure: Pull.doneExitFromCause })"
|
|
effect/Take#isDone:
|
|
replacement: "Exit.isExit(take) && Exit.isSuccess(take)"
|
|
note: "End-of-stream is the successful-Exit branch of the union."
|
|
effect/Take#isFailure:
|
|
replacement: "Exit.isExit(take) && Exit.isFailure(take)"
|
|
note: "A failure Take is the failed-Exit branch of the union."
|
|
effect/Take#isSuccess:
|
|
replacement: "!Exit.isExit(take)"
|
|
note: "A value batch is the non-Exit branch; use Array.isReadonlyArrayNonEmpty(take) when a positive refinement to NonEmptyReadonlyArray<A> is needed."
|
|
effect/Take#make:
|
|
replacement: "none"
|
|
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."
|
|
effect/Take#map:
|
|
replacement: "Exit.isExit(take) ? take : Array.map(take, f)"
|
|
note: "Only the value batch is mapped; effect's Array.map preserves the NonEmptyReadonlyArray type, and Exit branches (failure/end) pass through unchanged."
|
|
effect/Take#match:
|
|
replacement: "Exit.isExit + Exit.match"
|
|
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)."
|
|
example: |
|
|
// v3: Take.match(take, { onEnd, onFailure, onSuccess })
|
|
Exit.isExit(take)
|
|
? Exit.match(take, { onSuccess: () => onEnd(), onFailure: (cause) => onFailure(cause) })
|
|
: onSuccess(take)
|
|
effect/Take#matchEffect:
|
|
replacement: "Pull.matchEffect(Take.toPull(take), { onSuccess, onFailure, onDone })"
|
|
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."
|
|
effect/Take#of:
|
|
replacement: "[value]"
|
|
note: "A single-value Take is just the one-element non-empty array literal."
|
|
effect/Take#tap:
|
|
replacement: "Exit.isExit(take) ? Exit.asVoid(take) : Effect.asVoid(f(take))"
|
|
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."
|