Package: effect
Module: Tuple
Transforms elements of a tuple by providing an array of transform functions. Each function applies to the element at the same position. Positions beyond the array’s length are copied unchanged.
When to use
Use when you want to update the first N elements while keeping the rest.
Details
Each transform function receives the current value and can return a different type.
Example (Transforming selected elements)
import { pipe, Tuple } from "effect"
const result = pipe(
Tuple.make("hello", 42, true),
Tuple.evolve([
(s) => s.toUpperCase(),
(n) => n * 2
])
)
console.log(result) // ["HELLO", 84, true]
See
map – apply the same transformation to all elementsrenameIndices – swap element positionsSignature
declare const evolve: { <const T extends ReadonlyArray<unknown>, const E extends Evolver<T>>(evolver: E): (self: T) => Evolved<T, E>; <const T extends ReadonlyArray<unknown>, const E extends Evolver<T>>(self: T, evolver: E): Evolved<T, E>; }
Since v4.0.0