import type { List } from "."; import type { Args, GenericFn, GenericResolver } from "../HKT"; import type { None, Option, Some } from "../Option"; /** * Get the first element in a {@link List}. * * Sig: `(xs: List) => Option` */ export type Head = TS extends readonly [infer Head, ...unknown[]] ? Some : None; interface Resolver extends GenericResolver<[List], Option> { on1: ([xs]: Args) => [[], Option<(typeof xs)[number]>]; } /** * Get the first element in a {@link List}. * * Sig: `(xs: List) => Option` */ export default interface HeadFn extends GenericFn { def: ([xs]: Args) => Head; }