This commit is contained in:
parent
e37802e9dc
commit
5cb1c9bff9
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
|
||||
|
|
|
|||
12
src/dune
12
src/dune
|
|
@ -7,8 +7,9 @@
|
|||
(library
|
||||
(name mte)
|
||||
(wrapped false)
|
||||
(modules :standard \ mte base_32)
|
||||
(modules :standard \ mte base_32 amount)
|
||||
(libraries
|
||||
amount
|
||||
base_32
|
||||
;
|
||||
include
|
||||
|
|
@ -23,13 +24,16 @@
|
|||
jsont
|
||||
cohttp))
|
||||
|
||||
; crockford base32, as a lib to use [Base32] by accident *)
|
||||
|
||||
(library
|
||||
(library ; crockford base32
|
||||
(name base_32)
|
||||
(modules base_32)
|
||||
(libraries base32))
|
||||
|
||||
(library
|
||||
(name amount)
|
||||
(modules amount)
|
||||
(libraries angstrom fmt zarith))
|
||||
|
||||
(rule
|
||||
(target assets_crunch.ml)
|
||||
(deps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue