package safemoney

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val make : string -> t

Construction

Constructing Z by using a private type, create a Z value from string, e.g. from_str "123". Reason behind is to disallow a range of functions that are unsuitable for currency operations. For convenience the function alias make_z can be used.

type showable = {
  1. 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 sexp_of_showable : showable -> Sexplib0.Sexp.t
val showable_of_sexp : Sexplib0.Sexp.t -> showable
val neg : t -> t

Negate a Z value

val abs : t -> t

Return an absolute Z value

val signum : t -> int

Return the sign of Z value, -1, 0, or 1 when the argument is respectively negative, null, or positive.

val add : t -> t -> t

Add two Z values

val sub : t -> t -> t

Substract two Z values

val mul : t -> t -> t

Multiply two Z values

val to_str : t -> string

Convert a Z value to string

val to_float : t -> float

Convert a Z value to float

val to_showable_json : t -> string

Convert a Q value to printable rep