Package: effect
Module: TxChunk
Maps each element of the TxChunk using a function that returns the same
element type.
Details
This function mutates the original TxChunk by transforming each element in place. It does not
return a new TxChunk reference.
Example (Mapping elements)
import { Chunk, Effect, TxChunk } from "effect"
const program = Effect.gen(function*() {
const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4])
// Transform each element atomically (must maintain same type)
yield* TxChunk.map(txChunk, (n) => n * 2)
const result = yield* TxChunk.get(txChunk)
console.log(Chunk.toReadonlyArray(result)) // [2, 4, 6, 8]
})
Signature
declare const map: { <A>(f: (a: NoInfer<A>) => A): (self: TxChunk<A>) => Effect.Effect<void>; <A>(self: TxChunk<A>, f: (a: A) => A): Effect.Effect<void>; }
Since v4.0.0