Hyperlinkv0.8.0-beta.28

TxChunk

TxChunk.appendAllconsteffect/TxChunk.ts:734
<A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void>

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]
})
combinators
Source effect/TxChunk.ts:7348 lines
export const appendAll: {
  <A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
  <A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void>
} = dual(
  2,
  <A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void> =>
    update(self, (current) => Chunk.appendAll(current, other))
)
Referenced by 1 symbols