UNPKG

money-ts

Version:

TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals

27 lines (26 loc) 1.17 kB
import { Newtype } from 'newtype-ts'; import { Setoid } from 'fp-ts/lib/Setoid'; import { Ord } from 'fp-ts/lib/Ord'; import { BigInteger } from 'big-integer'; import { NonZeroInteger } from './NonZeroInteger'; import { Ring } from 'fp-ts/lib/Ring'; export interface Integer extends Newtype<{ Integer: true; }, BigInteger> { } export declare const wrap: (x: BigInteger) => Integer; export declare const unwrap: (x: Integer) => BigInteger; export declare const add: (x: Integer, y: Integer) => Integer; export declare const mul: (x: Integer, y: Integer) => Integer; export declare const one: Integer; export declare const negate: (x: Integer) => Integer; export declare const sub: (x: Integer, y: Integer) => Integer; export declare const zero: Integer; export declare function div(x: Integer, y: NonZeroInteger): Integer; export declare const setoid: Setoid<Integer>; export declare const isZero: (x: Integer) => boolean; export declare function sign(x: Integer): -1 | 0 | 1; export declare const ord: Ord<Integer>; export declare const isPositive: (x: Integer) => boolean; export declare function show(x: Integer): string; export declare const ring: Ring<Integer>;