//#region src/hkt.d.ts /** Symbol key for the argument tuple applied to an HKT instance. */ declare const PARAMS: unique symbol; /** Symbol key for the applied type produced by an HKT instance. */ declare const TYPE: unique symbol; /** * Encoding for a higher-kinded type * * @example * type Maybe = * | { readonly _tag: "Some"; readonly value: A } * | { readonly _tag: "None" }; * * interface MaybeF extends HKT { * readonly [HKT.TYPE]: Maybe>; * } * * type Name = HKT.Apply; * // ^? Maybe */ interface HKT extends HKT.Parameterized { readonly [TYPE]: unknown; } declare const HKT: Readonly<{ PARAMS: typeof PARAMS; TYPE: typeof TYPE; }>; declare namespace HKT { type PARAMS = typeof PARAMS; type TYPE = typeof TYPE; /** Phantom slot carrying the argument tuple for an {@link Apply} instantiation. */ interface Parameterized { readonly [PARAMS]: Args; } /** Gets the `N`th argument from an HKT instance */ type Param = Self[PARAMS][N]; /** * Value-level witness that constructor `F` is already applied to `Args`. * * Compositional helpers such as {@link Fix12} should target the bare constructor * (`Fix12`), not `Fix12, ...>`: {@link Apply} intersects a new * arg tuple onto `[PARAMS]`, so rebinding an {@link Applied} instance collides with the * stored tuple and collapses slots to `never`. */ type Applied = F & Parameterized; /** Applies HKT `F` to argument tuple `Args` and returns the `[TYPE]` type. */ type Apply = (F & Parameterized)[typeof TYPE]; /** Composes two HKTs: the applied type of `G` on the first argument flows into `F`. */ interface Compose extends HKT { readonly [TYPE]: Apply]>]>; } /** Swaps the first two arguments before applying `F`. */ interface Flip extends HKT { readonly [TYPE]: Apply, Param]>; } /** Fixes the first argument to `A` before applying `F`. */ interface Fix1 extends HKT { readonly [TYPE]: Apply]>; } /** Fixes the second argument to `B` before applying `F`. */ interface Fix2 extends HKT { readonly [TYPE]: Apply, B]>; } /** Fixes the first two arguments to `A` and `B` before applying `F`. */ interface Fix12 extends HKT { readonly [TYPE]: Apply]>; } } //#endregion export { HKT as t }; //# sourceMappingURL=hkt-C84w3kEn.d.mts.map