effect-io-ai

Package: effect
Module: TxChunk

TxChunk.appendAll

Concatenates another chunk to the end of the TxChunk.

Details

This function mutates the original TxChunk by appending all elements from the other chunk. It does not return a new TxChunk reference.

Example (Appending another chunk)

import { Chunk, Effect, TxChunk } from "effect"

const program = Effect.gen(function*() {
  const txChunk = yield* TxChunk.fromIterable([1, 2, 3])
  const otherChunk = Chunk.fromIterable([4, 5, 6])

  // Append all elements from another chunk atomically
  yield* TxChunk.appendAll(txChunk, otherChunk)

  const result = yield* TxChunk.get(txChunk)
  console.log(Chunk.toReadonlyArray(result)) // [1, 2, 3, 4, 5, 6]
})

Signature

declare const appendAll: { <A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>; <A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void>; }

Source

Since v4.0.0