Package: effect
Module: TxChunk
Prepends an element to the beginning of the TxChunk.
Details
This function mutates the original TxChunk by adding the element to the beginning. It does not return a new TxChunk reference.
Example (Prepending an element)
import { Chunk, Effect, TxChunk } from "effect"
const program = Effect.gen(function*() {
const txChunk = yield* TxChunk.fromIterable([2, 3, 4])
// Add element to the beginning atomically
yield* TxChunk.prepend(txChunk, 1)
const result = yield* TxChunk.get(txChunk)
console.log(Chunk.toReadonlyArray(result)) // [1, 2, 3, 4]
})
Signature
declare const prepend: { <A>(element: A): (self: TxChunk<A>) => Effect.Effect<void>; <A>(self: TxChunk<A>, element: A): Effect.Effect<void>; }
Since v4.0.0