summaryrefslogtreecommitdiff
path: root/lib/manifest.ml
diff options
context:
space:
mode:
authortoastal2026-04-15 01:49:13 +0000
committerยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค2026-04-15 01:49:13 +0000
commit47363e258f3e3f916cfe592e5de3bbe63bc16f84 (patch)
tree0c1d37439505aa742bba112518416d54878138f4 /lib/manifest.ml
parent9b65a20925349dbdc5919041d81cbd12ad8facf1 (diff)
downloadnixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.tar
nixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.tar.gz
nixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.tar.bz2
nixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.tar.lz
nixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.tar.xz
nixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.tar.zst
nixtaml-47363e258f3e3f916cfe592e5de3bbe63bc16f84.zip
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.
Diffstat (limited to 'lib/manifest.ml')
-rw-r--r--lib/manifest.ml13
1 files changed, 5 insertions, 8 deletions
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);