package safemoney

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Parameters

module Qv : Qv_intf.S

Signature

exception IntermediaryMismatch of string
type t = {
  1. src : string;
    (*

    Source.

    *)
  2. dst : string;
    (*

    Destination.

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

    Exhange Rate.

    *)
}

Types

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

showable for t

val showable_to_yojson : showable -> Yojson.Safe.t
val show_showable : showable -> Ppx_deriving_runtime.string
val sexp_of_showable : showable -> Sexplib0.Sexp.t
val showable_of_sexp : Sexplib0.Sexp.t -> showable
val make_xchg : src:string -> dst:string -> Qv.t -> t

Construction

Construct exchange rate, e.g. make_xchg "GBP" "AUD" Utils.make_q(19400/1000)

val show_xchg : t -> unit

Print the exchange rate

val (**>) : t -> t -> t

Exchange rate composition

val xchg_recip : t -> t

Apply reciprocal to exchange rate. xchg_recip (xchg_recip xchg) = id

val to_showable_json : t -> string

Convert t to showable rep

OCaml

Innovation. Community. Security.