import type { Ary, AryL } from "."; import type { Args, Fn } from "../HKT"; import type { List } from "../List"; import type { Show, TypeClass$$Show } from "../typeclass"; import type { Show as Show_ } from "../typeclass/Show/Show"; declare module "../typeclass/Show" { interface ShowImpl { array: ImplShowFor, Ary$$Show>; } } /** * Implementation of the {@link Show} type class for {@link Ary} (i.e., `Array` and `ReadonlyArray`). */ export interface Ary$$Show extends TypeClass$$Show> { Show: Ary$$Show$ShowFn; } /** * [Fn] Show an {@link Ary} (i.e., `Array` or `ReadonlyArray`). */ interface Ary$$Show$ShowFn extends Fn<[Ary], string> { // @ts-ignore - Return type annotation circularly references itself. def: ([xs]: Args) => Ary$$Show$Show; } /** * Show an {@link Ary} (i.e., `Array` or `ReadonlyArray`). */ type Ary$$Show$Show> = [TS] extends [unknown[]] ? number extends TS["length"] ? // @ts-ignore - Type instantiation is excessively deep and possibly infinite. `Array<${Show_}>` : `[${ShowTuple}]` : number extends TS["length"] ? `ReadonlyArray<${Show_}>` : `readonly [${ShowTuple}]`; type ShowW = [S] extends [Show] ? Show_ : never; type ShowTuple> = [TS] extends [readonly [infer T]] ? ShowW : [TS] extends [readonly [infer H, ...infer T extends List]] ? `${ShowW}, ${ShowTuple}` : "";