JJ: Description from the destination commit:

better parse_config

JJ: Description from source commit:
better parse_config
This commit is contained in:
swrup 2025-11-20 18:38:01 +01:00
parent e2d3986989
commit 91456f5715
4 changed files with 275 additions and 98 deletions

View file

@ -35,19 +35,15 @@ let make ~sign ~currency ~value ~fraction =
in
Ok { sign; currency; value; fraction }
let to_string =
let pp =
let open Fmt in
let pp_sign ppf = function
| `Plus -> char ppf '+'
| `Minus -> char ppf '-'
in
let pp_currency ppf = function `Eur -> string ppf "EUR" in
fun ppf { sign; currency; value; fraction } ->
pf ppf "%a%a:%Ld.%02ld" (Fmt.option pp_sign) sign pp_currency currency
value fraction
in
Fmt.str "%a" pp
let pp =
let open Fmt in
let pp_sign ppf = function `Plus -> char ppf '+' | `Minus -> char ppf '-' in
let pp_currency ppf = function `Eur -> string ppf "EUR" in
fun ppf { sign; currency; value; fraction } ->
pf ppf "%a%a:%Ld.%02ld" (Fmt.option pp_sign) sign pp_currency currency value
fraction
let to_string = Fmt.str "%a" pp
let of_string =
let open Angstrom in