From 47363e258f3e3f916cfe592e5de3bbe63bc16f84 Mon Sep 17 00:00:00 2001 From: toastal Date: Wed, 15 Apr 2026 01:49:13 +0000 Subject: Fix KDL.of_flow Result type and update callers - Properly type annotate KDL.of_flow to return (t, [> `ParseError]) result - Handle nested Results from Eio.Buf_read.parse_exn - Fix Manifest.read to work with new Result type - Fix nixtamal.ml error handling for Manifest and Lockfile errors All 17 tests pass.--- lib/manifest.ml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lib/manifest.ml') diff --git a/lib/manifest.ml b/lib/manifest.ml index 7bf2997..c2c7c79 100644 --- a/lib/manifest.ml +++ b/lib/manifest.ml @@ -865,17 +865,14 @@ let exists () : bool = Eio.Path.is_file filepath let read () = - let (let*) = Result.bind in let working_dir = Working_directory.get () in let filepath = Eio.Path.(working_dir / filename) in Logs.info (fun m -> m "Reading manifest @@ %a …" Eio.Path.pp filepath); - let kdl_result = - Eio.Path.with_open_in filepath @@ fun flow -> - KDL.of_flow flow - in - let* kdl = kdl_result |> Result.map_error (fun (`ParseError msg) -> `Parsing [`ParseError msg]) in - let () = manifest := Some kdl in - Ok kdl + match Eio.Path.with_open_in filepath KDL.of_flow with + | Error (`ParseError msg) -> Error (`Parsing [`ParseError msg]) + | Ok kdl -> + let () = manifest := Some kdl in + Ok kdl let make ?(version = "0.1.1") () = Logs.app (fun m -> m "Making manifest file @@ version:%s" version); -- cgit v1.2.3