From 5603dd215b5a20b892db5503f9dac81fd2c2e426 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 14 Dec 2016 17:01:38 +0600 Subject: T210: Do not use the Result compatibility library, use built-in result type. Use of the Result module from a compatibility library came from using Yojson for config parsing, which uses it for compatibility with older OCaml, since the ('a, 'b) result type appeared in Pervasives only in OCaml 4.03 All projects using vyconf library, however, by definition will be new projects, and will not have any reasons to use older compilers. --- src/vyconf_config.ml | 4 ++-- src/vyconf_config.mli | 2 +- src/vyconfd.ml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/vyconf_config.ml b/src/vyconf_config.ml index 21c23ee..10b505d 100644 --- a/src/vyconf_config.ml +++ b/src/vyconf_config.ml @@ -66,7 +66,7 @@ let load filename = let conf = {conf with log_file = get_field conf_toml "vyconf" "log_file"} in Result.Ok conf with - | Sys_error msg -> Result.Error msg - | Toml.Parser.Error (msg, _) -> Result.Error msg + | Sys_error msg -> Error msg + | Toml.Parser.Error (msg, _) -> Error msg let dump = show_vyconf_config diff --git a/src/vyconf_config.mli b/src/vyconf_config.mli index bd70652..b1679ae 100644 --- a/src/vyconf_config.mli +++ b/src/vyconf_config.mli @@ -10,6 +10,6 @@ type vyconf_config = { log_file: string option; } -val load : string -> (vyconf_config, string) Result.result +val load : string -> (vyconf_config, string) result val dump : vyconf_config -> string diff --git a/src/vyconfd.ml b/src/vyconfd.ml index e33f8c7..9549a97 100644 --- a/src/vyconfd.ml +++ b/src/vyconfd.ml @@ -27,8 +27,8 @@ let usage = "Usage: " ^ Sys.argv.(0) ^ " [options]" let load_config path = let result = Vyconf_config.load path in match result with - | Result.Ok cfg -> cfg - | Result.Error err -> + | Ok cfg -> cfg + | Error err -> Lwt_log.fatal (Printf.sprintf "Could not load the configuration file %s" err) |> Lwt.ignore_result; exit 1 -- cgit v1.2.3