export type NonEmptyArrayOrd = Array> & { readonly 0: Ord } export type TupleOrd = Readonly< { [K in keyof T]: [T[K]] extends [Ord] ? A : never } > /** * Derives an Ord instance for a tuple * * @tsplus static Ord/Ops tuple */ export function tuple( ...ords: T & { readonly 0: Ord } ): Ord> { return Ord((first, second) => { let i = 0 for (; i < ords.length - 1; i++) { const r = ords[i]!.compare(first[i], second[i]) if (r !== 0) { return r } } return ords[i]!.compare(first[i], second[i]) }) }