From 6b8cdd36608affc95617c48551c832147aff2e19 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Mon, 9 Mar 2026 22:40:21 +0100 Subject: asdf --- lib/account/account.ml | 12 +++++------- lib/account/type_hierarchy.ml | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/account/account.ml b/lib/account/account.ml index 0ef3d28..56734c3 100644 --- a/lib/account/account.ml +++ b/lib/account/account.ml @@ -76,7 +76,7 @@ let rec unsafe_update_bal_aux (aid : Path.t) (dc : Money.Debit_credit.t) | None -> Error Not_found | Some subacc -> let open Result.Let_syntax in - let%bind subacc' = + let%map subacc' = (* TODO: when reporting at which level Not_found fails, we want to make sure that we extend the information in the error with the current aid0 (so we recover a @@ -86,7 +86,7 @@ let rec unsafe_update_bal_aux (aid : Path.t) (dc : Money.Debit_credit.t) let core' = Kernel.Subtree (Map.set subaccs ~key:aid0 ~data:subacc') in - Ok (Option.value_exn (Kernel.make w.type_ w.extra core'))) + Option.value_exn (Kernel.make w.type_ w.extra core')) (* Unfortunate but true, there has to be some kind of a root account with no type :) *) @@ -106,16 +106,14 @@ let unsafe_update_bal (aid : Path.t) (dc : Money.Debit_credit.t) we want to make sure that we extend the information in the error with the current aid0 (so we recover a full path to where the account is missing *) - let%bind subacc' = + let%map subacc' = unsafe_update_bal_aux aid' dc by_amount in_comm subacc in - Ok (Map.set w ~key:aid0 ~data:subacc')) + Map.set w ~key:aid0 ~data:subacc') module Balanced_batch_acc_paths = Balanced_batch.Make (Path) let apply_balanced_batch (b : Balanced_batch_acc_paths.t) (w : root) = Map.fold_result (Balanced_batch_acc_paths.entries b) ~init:w ~f:(fun ~key:aid ~(data : Balanced_batch_acc_paths.entry) w -> - let open Result.Let_syntax in - let%bind w = unsafe_update_bal aid data.dc data.amount data.commodity w in - Ok w) + unsafe_update_bal aid data.dc data.amount data.commodity w) diff --git a/lib/account/type_hierarchy.ml b/lib/account/type_hierarchy.ml index 7f27830..8c20f07 100644 --- a/lib/account/type_hierarchy.ml +++ b/lib/account/type_hierarchy.ml @@ -31,9 +31,9 @@ let canonical : trunk = make [ ("Accounts_payable", make []); ("Credit", make []) ] ) ); ] -(* In this module, only the following two function entertains the - option that the given path may not be valid (i.e., it does not - throw an exception for invalid paths). *) +(* In this module, only the following function entertains the option + that the given path may not be valid (i.e., it does not throw an + exception for invalid paths). *) let rec get_node : path -> tree option = let open Option.Let_syntax in function -- cgit v1.3