From 5cb1c9bff99e86173c003a6637ca0223b0e76955 Mon Sep 17 00:00:00 2001 From: swrup Date: Mon, 13 Oct 2025 04:15:58 +0200 Subject: [PATCH] --- src/amount.ml | 3 ++- src/dune | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/amount.ml b/src/amount.ml index 228261be..5401b27e 100644 --- a/src/amount.ml +++ b/src/amount.ml @@ -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 diff --git a/src/dune b/src/dune index 09f9cdfd..14dee822 100644 --- a/src/dune +++ b/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