import type { Applicative, Applicative$GetTypeClassW } from "."; import type { Args, Call2W, Fn1, GenericFn, GenericResolver, GenericReturn1W, Param0W, ReturnW, } from "../../HKT"; import type { HKT$Extract, HKT$GetConstruct, HKT$Mutate } from "../HKT"; /** * Apply an {@link Applicative} of a function to an {@link Applicative} of a value. * * Sig: `, T, U>(fab: F<(x: T) => U>, f: F) => F` */ export type Ap< FAB extends HKT$Mutate, unknown>>, F extends Applicative, > = Call2W["Ap"], FAB, F>; interface Resolver extends GenericResolver<[Applicative, Applicative], Applicative> { on1_: ([fab]: Args) => [ [HKT$Mutate>>], HKT$Mutate>>, ]; on_1: ([, f]: Args) => [ [HKT$Mutate, unknown>>], HKT$GetConstruct, ]; on11: ([fab, f]: Args) => [ [], HKT$Mutate, HKT$Extract>>, ]; } /** * [Fn] Apply an {@link Applicative} of a function to an {@link Applicative} of a value. * * Sig: `, T, U>(fab: F<(x: T) => U>, f: F) => F` */ export default interface ApFn extends GenericFn { def: ([fab, f]: Args) => typeof fab extends ( HKT$Mutate, unknown>> ) ? Ap : never; }