Package: effect
Module: TxChunk
Sets the value of the TxChunk.
Details
This function mutates the original TxChunk by replacing its internal state with the provided chunk. It does not return a new TxChunk reference.
Example (Replacing the stored chunk)
import { Chunk, Effect, TxChunk } from "effect"
const program = Effect.gen(function*() {
const txChunk = yield* TxChunk.fromIterable([1, 2, 3])
// Replace the entire chunk content
const newChunk = Chunk.fromIterable([10, 20, 30, 40])
yield* TxChunk.set(txChunk, newChunk)
const result = yield* TxChunk.get(txChunk)
console.log(Chunk.toReadonlyArray(result)) // [10, 20, 30, 40]
})
Signature
declare const set: { <A>(chunk: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>; <A>(self: TxChunk<A>, chunk: Chunk.Chunk<A>): Effect.Effect<void>; }
Since v4.0.0