From 27ce25ededbf22e9254e0d5ee2affebb25bd1107 Mon Sep 17 00:00:00 2001 From: swrup Date: Tue, 11 Nov 2025 02:32:45 +0100 Subject: [PATCH] --- .ocamlformat | 2 +- dune-project | 9 +++++++++ src/assets.ml | 12 ++++++------ src/headers.ml | 22 +++++++++++----------- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index ba7cb18e..4d907d30 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,4 +1,4 @@ -version=0.27.0 +version=0.28.1 exp-grouping=preserve type-decl=sparse break-infix=fit-or-vertical diff --git a/dune-project b/dune-project index 8b2e9ddb..212175b3 100644 --- a/dune-project +++ b/dune-project @@ -28,5 +28,14 @@ jsont cohttp fmt + bin + angstrom + zarith + mirage-crypto + digestif + duration + jsont + cohttp + ptime (ocamlformat :with-dev-setup) )) diff --git a/src/assets.ml b/src/assets.ml index 641ec01a..846291fa 100644 --- a/src/assets.ml +++ b/src/assets.ml @@ -87,12 +87,12 @@ let supported_lang_arr, supported_ext_arr = let lang_l = path_l |> List.map (fun path -> - match Fpath.segs path with - | [] -> assert false - | [ dir; _file ] -> dir - | _l -> - Fmt.failwith "invalid folder structure, file `%s` is misplaced" - (Fpath.to_string path)) + match Fpath.segs path with + | [] -> assert false + | [ dir; _file ] -> dir + | _l -> + Fmt.failwith "invalid folder structure, file `%s` is misplaced" + (Fpath.to_string path)) |> List.sort_uniq String.compare in let () = diff --git a/src/headers.ml b/src/headers.ml index caea02d6..ae740b4f 100644 --- a/src/headers.ml +++ b/src/headers.ml @@ -25,12 +25,12 @@ let select_language headers = |> Cohttp.Accept.qsort |> List.map (fun (_q, lang) -> lang) |> List.map (function - | Cohttp.Accept.AnyLanguage -> Assets.default_lang - | Language language_range -> ( - (* ignore language subtags (e.g. "en-US" -> "en") *) - match language_range with - | [] -> assert false - | primary_tag :: _ -> primary_tag)) + | Cohttp.Accept.AnyLanguage -> Assets.default_lang + | Language language_range -> ( + (* ignore language subtags (e.g. "en-US" -> "en") *) + match language_range with + | [] -> assert false + | primary_tag :: _ -> primary_tag)) |> List.find_opt Assets.is_supported_lang |> Option.value ~default:Assets.default_lang @@ -40,11 +40,11 @@ let select_encoding headers = |> Cohttp.Accept.qsort |> List.map snd |> List.filter_map (function - | Cohttp.Accept.Identity -> Some `Identity - | Deflate -> Some `DEFLATE - | Gzip -> Some `Gzip - | AnyEncoding -> Some Assets.default_encoding - | Encoding _ | Compress -> (* unsupported *) None) + | Cohttp.Accept.Identity -> Some `Identity + | Deflate -> Some `DEFLATE + | Gzip -> Some `Gzip + | AnyEncoding -> Some Assets.default_encoding + | Encoding _ | Compress -> (* unsupported *) None) |> function | [] -> assert false | `Identity :: _ -> None