diff options
author | Daniil Baturin <daniil@baturin.org> | 2016-12-14 17:01:38 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2016-12-14 17:01:38 +0600 |
commit | 5603dd215b5a20b892db5503f9dac81fd2c2e426 (patch) | |
tree | 9f41d5735bac851dc968beb4cc36af2f59b3611e /src | |
parent | 6f33b924f5e9dcd898714ab810101d7922d09e27 (diff) | |
download | vyconf-5603dd215b5a20b892db5503f9dac81fd2c2e426.tar.gz vyconf-5603dd215b5a20b892db5503f9dac81fd2c2e426.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/vyconf_config.ml | 4 | ||||
-rw-r--r-- | src/vyconf_config.mli | 2 | ||||
-rw-r--r-- | src/vyconfd.ml | 4 |
3 files changed, 5 insertions, 5 deletions
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 |