import type { None, Option, Some } from "."; import type { Args, Call1, Fn1, GenericFn, GenericResolver, Param0, Return } from "../HKT"; /** * Apply a function to an {@link Option} value if it is {@link Some}, otherwise return {@link None}. * * Sig: `(f: (x: T) => U, o: Option) => Option` */ export type Map> = O extends Some> ? Some> : None; interface Resolver extends GenericResolver<[Fn1, Option], Option> { on1_: ([f]: Args) => [[Option>], Option>]; on_1: ([, o]: Args) => [ [Fn1 ? T : never>], Option, ]; on11: ([f, o]: Args) => [[], Option>]; } /** * [Fn] Apply a function to an {@link Option} value if it is {@link Some}, otherwise return * {@link None}. * * Sig: `(f: (x: T) => U, o: Option) => Option` */ export default interface MapFn extends GenericFn { def: ([f, o]: Args) => Map; }