summaryrefslogtreecommitdiff
path: root/src/util.ml
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2017-01-16 14:42:26 +0700
committerDaniil Baturin <daniil@baturin.org>2017-01-16 14:42:26 +0700
commit482321db949bf5b5b6868a3fc8cbeaaa589578e2 (patch)
tree40c2f82d6c22e3da56fb708a0174304fd3a37f1b /src/util.ml
parentcfff74d6774de069b3233c04771bfc26ee988bdd (diff)
downloadvyconf-482321db949bf5b5b6868a3fc8cbeaaa589578e2.tar.gz
vyconf-482321db949bf5b5b6868a3fc8cbeaaa589578e2.zip
Add a trivial 'a option -> 'a -> 'a function for substituting something for a default.
Diffstat (limited to 'src/util.ml')
-rw-r--r--src/util.ml5
1 files changed, 5 insertions, 0 deletions
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