import type { List } from "."; import type ConcatWFn from "./ConcatW"; import type { FoldL } from "./FoldL"; import type { Map } from "./Map"; import type { Args, Fn1, GenericFn, GenericResolver, Param0, Return } from "../HKT"; /** * Apply a function to each element of a {@link List} (i.e., fixed-length tuple) and concatenate the * results. * * Sig: `(f: (x: T) => List, xs: List) => List` */ export type FlatMap = FoldL< ConcatWFn, TS extends unknown[] ? [] : readonly [], Map >; interface Resolver extends GenericResolver<[Fn1, List], List> { on1_: ([f]: Args) => [[List>], List[number]>]; on_1: ([, xs]: Args) => [[Fn1<(typeof xs)[number]>], List]; on11: ([f, xs]: Args) => [[], List[number]>]; } /** * [Fn] Apply a function to each element of a {@link List} (i.e., fixed-length tuple) and * concatenate the results. * * Sig: `(f: (x: T) => List, xs: List) => List` */ export default interface FlatMapFn extends GenericFn { def: ([f, xs]: Args) => FlatMap; }