make amount.ml a lib
This commit is contained in:
parent
e37802e9dc
commit
d086bd7e12
2 changed files with 10 additions and 5 deletions
|
|
@ -17,8 +17,9 @@ type t = {
|
|||
fraction: Int64.t;
|
||||
}
|
||||
|
||||
let ( let* ) o f = match o with Ok v -> f v | Error _ as e -> e
|
||||
|
||||
let make ~sign ~currency ~value ~fraction =
|
||||
let open Syntax in
|
||||
let value_upper_bound = Z.(pow (of_int 2) 52) |> Z.to_int64 in
|
||||
let fraction_upper_bound = Int64.of_int 99_999_999 in
|
||||
let* () = if value < Int64.zero then Error "value is negative" else Ok () in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue