UNPKG

money-ts

Version:

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

14 lines (13 loc) 833 B
import { Newtype } from 'newtype-ts'; import { PositiveRational } from './PositiveRational'; import { Setoid } from 'fp-ts/lib/Setoid'; import { Ord } from 'fp-ts/lib/Ord'; import { Dense } from './Dense'; export interface ExchangeRate<S, D> extends Newtype<['ExchangeRate', S, D], PositiveRational> { } export declare const wrap: <S, D>(r: PositiveRational) => ExchangeRate<S, D>; export declare const unwrap: <S, D>(er: ExchangeRate<S, D>) => PositiveRational; export declare const exchange: <S extends string, D extends string>(er: ExchangeRate<S, D>) => (d: Dense<S>) => Dense<D>; export declare function compose<A, B, C>(bc: ExchangeRate<B, C>, ab: ExchangeRate<A, B>): ExchangeRate<A, C>; export declare const getSetoid: <S, D>() => Setoid<ExchangeRate<S, D>>; export declare const getOrd: <S, D>() => Ord<ExchangeRate<S, D>>;