package safemoney

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
exception ValidScaleError of string
type t = {
  1. symbol : string;
    (*

    Currency Symbol

    *)
  2. unit : string;
    (*

    Currency Unit Name

    *)
  3. value : Qv.t;
    (*

    Scale Value in Rational

    *)
}

Types

Scale Representation

Almost every currency has a unit value and sub unit values e.g. Pound is unit value for GBP with a scale of 1 to 1 Penny is sub unit value for GBP with scale of 100 to 1.

include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
type showable = {
  1. symbol_ : string;
  2. unit_ : string;
  3. value_ : string;
}

showable for t

val pp_showable : Ppx_deriving_runtime.Format.formatter -> showable -> Ppx_deriving_runtime.unit
val show_showable : showable -> Ppx_deriving_runtime.string
val showable_to_yojson : showable -> Yojson.Safe.t
val showable_of_yojson : Yojson.Safe.t -> showable Ppx_deriving_yojson_runtime.error_or
val sexp_of_showable : showable -> Sexplib0.Sexp.t
val showable_of_sexp : Sexplib0.Sexp.t -> showable
val make_scale : string -> string -> Qv.t -> t

Construction

Construct exchange rate, e.g. make_scale "GBP" "penny" Utils.make_q("100/1")

val check_scale : Qv.t -> bool

Required scale to be position

val to_showable_json : t -> string

Convert t to showable rep

OCaml

Innovation. Community. Security.