← all modules

Std.Money

Std.Money
  Std.Money — currency-typed Money on `Std.Decimal` (Layer 3 Sky source).

Types
  type Currency = USD | EUR | GBP | JPY | CHF | AUD | CAD | NZD | SEK | NOK | DKK | CNY | HKD | SGD | KRW | TWD | INR | THB | MYR | IDR | PHP | VND | BRL | MXN | ARS | CLP | ZAR | TRY | RUB | UAH | PLN | CZK | HUF | RON | BGN | AED | SAR | QAR | KWD | BHD | OMR | JOD | ILS | EGP | NGN | KES | GHS | MAD | TND | DZD | PKR | BDT | LKR | NPR | BTC | ETH | USDT | USDC | CurrencyRaw String
  type Money = Money Decimal Currency

Values
  abs : Money -> Money
  add : Money -> Money -> Money
  addPercent : Decimal -> Money -> Money
  allocate : Int -> Money -> List Money
      Allocate a Money value across N parts as evenly as possible,
  amount : Money -> Decimal
  clearRates : () -> Result Error ()
  compare : Money -> Money -> Int
  convert : Currency -> Money -> Result Error Money
      Convert Money to a target currency using the registered rate.
  currency : Money -> Currency
  currencyCode : Currency -> String
  currencyName : Currency -> String
  eq : Money -> Money -> Bool
  format : Money -> String
      Default symbol-prefixed form: "$12.34", "¥1234" (JPY).
  formatWithCode : Money -> String
      ISO-code suffix form: "12.34 USD". Preferred for B2B.
  fromMajor : Currency -> Int -> Money
  fromMinor : Currency -> Int -> Money
  fromString : Currency -> String -> Result Error Money
  getRate : Currency -> Currency -> Result Error Decimal
  gt : Money -> Money -> Bool
  gte : Money -> Money -> Bool
  hasRate : Currency -> Currency -> Bool
  isKnownCode : String -> Bool
      Check whether the given ISO 4217 code maps to one of the
  isNegative : Money -> Bool
  isPositive : Money -> Bool
  isZero : Money -> Bool
  knownCurrency : Currency -> Bool
      Currency-typed counterpart: returns False ONLY for
  lt : Money -> Money -> Bool
  lte : Money -> Money -> Bool
  minorUnits : Currency -> Int
  mul : Decimal -> Money -> Money
      Multiply by a scalar (Decimal). Currency carries through.
  neg : Money -> Money
  neq : Money -> Money -> Bool
  parseCurrency : String -> Currency
  percentOf : Decimal -> Money -> Money
  setRate : Currency -> Currency -> Decimal -> Result Error ()
  sub : Money -> Money -> Money
  subPercent : Decimal -> Money -> Money
  sumOf : Currency -> List Money -> Money
      Sum a list of Money values (all should be same currency).
  symbol : Currency -> String
  toMinor : Money -> Int
      Integer-cents representation, for DB persistence.
  zero : Currency -> Money
  zeroOf : Money -> Money