FuncType - v0.60.3
    Preparing search index...

    Interface Tuple<T>

    Foldable type class represents data structures that can be folded to a summary value.

    This interface provides the universal fold operations (foldLeft, foldRight) that work consistently across all data structures. The fold method is intentionally excluded because it has different semantics for sum types vs collections:

    • Sum types (Option, Either, Try): fold(onEmpty, onValue) — pattern match
    • Collections (List, Set, Map): fold(initial, fn) — left-reduce accumulator

    Each type category defines its own fold with the appropriate signature.

    interface Tuple<out T extends Type[]> {
        _tag: "Tuple";
        "[toStringTag]": string;
        length: number;
        "[iterator]"(): Iterator<T[number]>;
        flatMap<U extends unknown[]>(f: (value: T) => Tuple<U>): Tuple<U>;
        fold<B>(initial: B, fn: (acc: B, a: T[number]) => B): B;
        foldLeft<B>(z: B): (op: (b: B, a: T[number]) => B) => B;
        foldRight<B>(z: B): (op: (a: T[number], b: B) => B) => B;
        get<K extends number>(index: K): T[K];
        map<U extends unknown[]>(f: (value: T) => U): Tuple<U>;
        pipe<U extends unknown>(f: (value: Tuple) => U): U;
        serialize(): SerializationMethods<Tuple<T>>;
        toArray(): T;
        toString(): string;
        toValue(): { _tag: "Tuple"; value: T };
    }

    Type Parameters

    • out T extends Type[]

      The type of elements in the data structure

    Hierarchy (View Summary)

    Index

    Properties

    _tag: "Tuple"
    "[toStringTag]": string
    length: number

    Methods

    • Returns Iterator<T[number]>

    • Type Parameters

      • U extends unknown[]

      Parameters

      Returns Tuple<U>

    • Type Parameters

      • B

      Parameters

      • initial: B
      • fn: (acc: B, a: T[number]) => B

      Returns B

    • Left-associative fold using the provided zero value and operation

      Type Parameters

      • B

      Parameters

      • z: B

        Zero/identity value

      Returns (op: (b: B, a: T[number]) => B) => B

      A function that takes an operation to apply

    • Right-associative fold using the provided zero value and operation

      Type Parameters

      • B

      Parameters

      • z: B

        Zero/identity value

      Returns (op: (a: T[number], b: B) => B) => B

      A function that takes an operation to apply

    • Type Parameters

      • K extends number

      Parameters

      • index: K

      Returns T[K]

    • Type Parameters

      • U extends unknown[]

      Parameters

      • f: (value: T) => U

      Returns Tuple<U>

    • Pipes the value through the provided function

      Type Parameters

      • U extends unknown

        The return type of the function

      Parameters

      • f: (value: Tuple) => U

        The function to apply to the value

      Returns U

      The result of applying the function to the value

    • Returns T

    • Returns a string representation of an object.

      Returns string

    • Returns { _tag: "Tuple"; value: T }