import type { List } from "."; import type { Flatten } from "./Flatten"; import type { Map } from "./Map"; import type { GenericReturn1W } from ".."; import type { Args, Fn1, GenericFn, GenericResolver, Param0W, ReturnW } from "../HKT"; import type { Applicative, TypeClass$$Applicative } from "../typeclass"; declare module "../typeclass/Applicative" { interface ApplicativeImpl { List: ImplApplicativeFor; } } /** * Implementation of the {@link Applicative} type class for {@link List}. */ export interface List$$Applicative extends TypeClass$$Applicative { Ap: List$$Applicative$ApFn; Of: List$$Applicative$OfFn; } interface ApResolver extends GenericResolver<[List, List], List> { on1_: ([fab]: Args) => [[Param0W<(typeof fab)[number]>], ReturnW<(typeof fab)[number]>]; on_1: ([, f]: Args) => [[List>], List]; on11: ([fab, f]: Args) => [ [], List>, ]; } /** * [Fn] Apply an {@link List} of a function to an {@link List} of a value if both are * {@link Some}, otherwise return {@link None}. */ interface List$$Applicative$ApFn extends GenericFn { def: ([fab, f]: Args) => List$$Applicative$Ap; } type List$$Applicative$Ap, F extends List> = Flatten<{ [K in keyof FAB]: Map; }>; interface OfResolver extends GenericResolver<[unknown], List> { on1: ([x]: Args) => [[], List]; } /** * [Fn] Build a {@link List} from a value (convert it to `readonly [x]`). */ interface List$$Applicative$OfFn extends GenericFn { def: ([x]: Args) => List$$Applicative$Of; } type List$$Applicative$Of = readonly [T];