From 482321db949bf5b5b6868a3fc8cbeaaa589578e2 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 16 Jan 2017 14:42:26 +0700 Subject: Add a trivial 'a option -> 'a -> 'a function for substituting something for a default. --- _oasis | 2 +- setup.ml | 13 +++++++++---- src/util.ml | 5 +++++ src/util.mli | 2 ++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/_oasis b/_oasis index 34701d0..6075221 100644 --- a/_oasis +++ b/_oasis @@ -13,7 +13,7 @@ Plugins: META (0.4), DevFiles (0.4) Library "vyconf" Path: src - Modules: Vytree, Vylist, Value_checker, Vyconf_config + Modules: Vytree, Vylist, Value_checker, Vyconf_config, Util Install: false Library "vytree" diff --git a/setup.ml b/setup.ml index 849789c..c343339 100644 --- a/setup.ml +++ b/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.4.8 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 602702c2b3e29065636a02e0e82ba6a6) *) +(* DO NOT EDIT (digest: d662f8d4da0a60b09228a8655e62c2a8) *) (* Regenerated by OASIS v0.4.8 Visit http://oasis.forge.ocamlcore.org for more information and @@ -7380,7 +7380,12 @@ let setup_t = }, { lib_modules = - ["Vytree"; "Vylist"; "Value_checker"; "Vyconf_config" + [ + "Vytree"; + "Vylist"; + "Value_checker"; + "Vyconf_config"; + "Util" ]; lib_pack = false; lib_internal_modules = []; @@ -11336,7 +11341,7 @@ let setup_t = }; oasis_fn = Some "_oasis"; oasis_version = "0.4.8"; - oasis_digest = Some "\164\128uZ\195\226\174r\220\161\232Msu\141\165"; + oasis_digest = Some "#Iza,I\028\140\r \250\017\0166\000C"; oasis_exec = None; oasis_setup_args = []; setup_update = false @@ -11344,7 +11349,7 @@ let setup_t = let setup () = BaseSetup.setup setup_t;; -# 11348 "setup.ml" +# 11353 "setup.ml" let setup_t = BaseCompat.Compat_0_4.adapt_setup_t setup_t open BaseCompat.Compat_0_4 (* OASIS_STOP *) diff --git a/src/util.ml b/src/util.ml index b45f011..2bac3d6 100644 --- a/src/util.ml +++ b/src/util.ml @@ -20,3 +20,8 @@ let string_of_path path = match path with | [] -> "" | x :: xs -> Printf.sprintf "%s%s" x (aux xs "") + +let substitute_default o d = + match o with + | None -> d + | Some v -> v diff --git a/src/util.mli b/src/util.mli index ec0bb73..7d78a15 100644 --- a/src/util.mli +++ b/src/util.mli @@ -1,3 +1,5 @@ val find_xml_child : string -> Xml.xml -> Xml.xml option val string_of_path : string list -> string + +val substitute_default : 'a option -> 'a -> 'a -- cgit v1.2.3