import { Collection } from "@tsplus/stdlib/collections/Collection/definition"; import { Equals } from "@tsplus/stdlib/structure/Equals"; import { Hash } from "@tsplus/stdlib/structure/Hash"; export declare const ListTypeId: unique symbol; export type ListTypeId = typeof ListTypeId; export declare const _A: unique symbol; export type _A = typeof _A; /** * @tsplus type List */ export type List = Cons | Nil; type ConsNS = Cons; type NilNS = Nil; export declare namespace List { type Cons = ConsNS; type Nil = NilNS; } /** * @tsplus type List.Ops */ export interface ListOps { readonly $: ListAspects; } export declare const List: ListOps; /** * @tsplus type List.Aspects */ export interface ListAspects { } export declare namespace List { /** * @tsplus type NonEmptyList */ type NonEmpty = Cons; } /** * @tsplus type List/Cons */ export declare class Cons implements Collection, Equals { readonly head: A; tail: List; readonly _tag = "Cons"; readonly [_A]: (_: never) => A; readonly [ListTypeId]: symbol; constructor(head: A, tail: List); [Symbol.iterator](): Iterator; [Hash.sym](): number; [Equals.sym](that: unknown): boolean; } /** * @tsplus type List/Nil */ export declare class Nil implements Collection, Equals { readonly _tag = "Nil"; readonly [_A]: (_: never) => A; readonly [ListTypeId]: symbol; [Symbol.iterator](): Iterator; [Hash.sym](): number; [Equals.sym](that: unknown): boolean; } export declare const _Nil: Nil; /** * @tsplus unify List * @tsplus unify List/Nil * @tsplus unify List/Cons */ export declare function unify>(self: X): List<[X] extends [{ readonly [_A]: (_: never) => infer A; }] ? A : never>; /** * @tsplus static List.Ops nil * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function nil(): Nil; /** * @tsplus static List.Ops cons * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function cons(head: A, tail: List): Cons; /** * @tsplus fluent List isNil * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function isNil(self: List): self is Nil; /** * @tsplus fluent List isCons * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function isCons(self: List): self is Cons; /** * Returns the number of elements contained in a `List` * @tsplus getter List length * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function length(self: List): number; /** * @tsplus static List.Aspects equalsWith * @tsplus pipeable List equalsWith * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function equalsWith(that: List, f: (a: A, b: B) => boolean): (self: List) => boolean; /** * @tsplus pipeable-operator List == * @tsplus static List.Aspects equals * @tsplus pipeable List equals * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function equals(that: List): (self: List) => boolean; export declare function equals(that: List): (self: List) => boolean; /** * Type guard * @tsplus static List.Ops isList * @tsplus location "@tsplus/stdlib/collections/List/definition" */ export declare function isList(u: Iterable): u is List; export declare function isList(u: unknown): u is List; export {}; //# sourceMappingURL=definition.d.ts.map