import type { Int } from "."; import type { Arg0, Arg1, Fn } from "../../HKT"; import type { LT } from "../../typeclass/Ord"; import type { Abs } from "../Abs"; import type { IsPos } from "../IsPos"; import type { Add as AddNat } from "../Nat/Add"; import type { Compare as CompareNat } from "../Nat/Compare"; import type { Sub as SubNat } from "../Nat/Sub"; import type { _StrToNum } from "../internal/_StrToNum"; /** * Add two {@link Int}s. * * Sig: `(n: Int, m: Int) => Int` */ export type Add = Int extends N | M ? number : IsPos extends true ? IsPos extends true ? AddNat : CompareNat> extends LT ? _StrToNum<`-${SubNat, N>}`> : SubNat> : IsPos extends true ? CompareNat> extends LT ? _StrToNum<`-${SubNat, M>}`> : SubNat> : _StrToNum<`-${AddNat, Abs>}`>; /** * [Fn] Add two {@link Int}s. * * Sig: `(n: Int, m: Int) => Int` */ export default interface AddFn extends Fn<[Int, Int], Int> { def: () => Add, Arg1>; }