add amount compare
This commit is contained in:
parent
4bb62e369d
commit
76662bf23c
3 changed files with 11 additions and 10 deletions
|
|
@ -47,6 +47,14 @@ let make ~sign ~currency ~value ~fraction =
|
|||
let currency = String.uppercase_ascii currency in
|
||||
Ok { sign; currency; value; fraction }
|
||||
|
||||
let compare a b =
|
||||
match String.equal a.currency b.currency with
|
||||
| false -> Fmt.failwith "amount compare on different currencies"
|
||||
| true -> (
|
||||
match Int64.unsigned_compare a.value b.value with
|
||||
| 0 -> Int32.unsigned_compare a.fraction b.fraction
|
||||
| n -> n)
|
||||
|
||||
module Parser = struct
|
||||
open Angstrom
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue