package safemoney

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

Module Safemoney.ExchangeSource

Sourceexception IntermediaryMismatch of string
Sourcetype t = {
  1. src_ : string;
    (*

    source

    *)
  2. dst_ : string;
    (*

    destination

    *)
  3. value_ : Q.t;
    (*

    exhange rate

    *)
}

Types

Type of exhange rate

Sourceval make_xchg : src:string -> dst:string -> Q.t -> t

Construction

make_xchg src dst qv makes an exchange rate, taking a src: "GBP", a dst: "AUD", and a qv: make_q(19400/1000)

Sourceval show_xchg : t -> unit

show_xchg t prints t

Sourceval (**>) : t -> t -> t

t1 **> t2 composes two different exchange rates, dst of t1 must equal to src of t2

Sourceval xchg_recip : t -> t

xchg_recip t applies reciprocal to exchange rate, xchg_recip (xchg_recip xchg) = id

Sourceval to_json : t -> Yojson.Safe.t

to_json t converts t to json string

Sourceval to_sexp : t -> Base.Sexp.t

to_sexp t converts t to sexp

OCaml

Innovation. Community. Security.