FuncType - v0.60.3
    Preparing search index...

    Variable FoldableUtilsConst

    FoldableUtils: {
        isEmpty: <A extends unknown>(foldable: PatternFoldable<A>) => boolean;
        size: <A extends unknown>(foldable: PatternFoldable<A>) => number;
        toEither: <A extends unknown, E>(
            foldable: PatternFoldable<A>,
            left: E,
        ) => Either<E, A>;
        toList: <A extends unknown>(foldable: PatternFoldable<A>) => List<A>;
        toOption: <A extends unknown>(foldable: PatternFoldable<A>) => Option<A>;
    } = ...

    Utility functions for working with sum-type Foldable data structures. These utilities use pattern-match fold semantics and are designed for sum types (Option, Either, Try) — not collections.

    Type Declaration

    • isEmpty: <A extends unknown>(foldable: PatternFoldable<A>) => boolean

      Checks if the sum type is empty

    • size: <A extends unknown>(foldable: PatternFoldable<A>) => number

      Calculates the size of the sum type (0 or 1)

    • toEither: <A extends unknown, E>(foldable: PatternFoldable<A>, left: E) => Either<E, A>

      Converts a sum type to an Either

    • toList: <A extends unknown>(foldable: PatternFoldable<A>) => List<A>

      Converts a sum type to a List

    • toOption: <A extends unknown>(foldable: PatternFoldable<A>) => Option<A>

      Converts a sum type to an Option