import type { List } from "."; import type { FoldL } from "./FoldL"; import type { Args, Fn } from "../HKT"; import type { Int } from "../Num"; import type AddFn from "../Num/Int/Add"; import type { AssertInt } from "../helpers"; /** * Calculate the sum of a {@link List} of {@link Int}s. * * Sig: `(ns: List) => Int` */ export type Sum> = AssertInt< FoldL extends infer R extends Int ? R : never >; /** * [Fn] Calculate the sum of a {@link List} of {@link Int}s. * * Sig: `(ns: List) => Int` */ export default interface SumFn extends Fn<[List], Int> { def: ([ns]: Args) => Sum; }