add data_file.ml

This commit is contained in:
swrup 2025-11-29 14:03:37 +01:00
parent 760e6de1fb
commit bc91f7357c
8 changed files with 207 additions and 101 deletions

View file

@ -38,3 +38,11 @@ let list_fold_left f acc l =
let* acc = acc in
f acc v)
(Ok acc) l
let opt_list l =
match (List.for_all Option.is_none l, List.for_all Option.is_some l) with
| _, true ->
let l = List.map Option.get l in
Ok (Some l)
| true, _ -> Ok None
| _, _ -> Error ()