module Decode = struct module S = struct type value = Otoml.t let pp : Format.formatter -> value -> unit = fun format t -> Format.pp_print_string format (Otoml.Printer.to_string t) let of_string : string -> (value, string) result = Otoml.Parser.from_string_result let of_file : string -> (value, string) result = Otoml.Parser.from_file_result let get_string : value -> string option = Otoml.get_opt Otoml.get_string let get_int : value -> int option = Otoml.get_opt Otoml.get_integer let get_float : value -> float option = Otoml.get_opt Otoml.get_float let get_bool : value -> bool option = Otoml.get_opt Otoml.get_boolean let get_null : value -> unit option = fun _ -> None let get_list : value -> value list option = Otoml.get_opt @@ Otoml.get_array Fun.id let get_key_value_pairs : value -> (value * value) list option = Otoml.get_opt (fun key -> Otoml.get_table key |> List.map (fun (k, v) -> (Otoml.string k, v))) let to_list : value list -> value = Otoml.array end include Decoders.Decode.Make (S) end