diff options
Diffstat (limited to 'src/Lib/Option.ml')
-rw-r--r-- | src/Lib/Option.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Lib/Option.ml b/src/Lib/Option.ml new file mode 100644 index 0000000..1158b96 --- /dev/null +++ b/src/Lib/Option.ml @@ -0,0 +1,9 @@ +let withDefault default opt = + match opt with + | Some v -> v + | None -> default + +let map f opt = + match opt with + | Some v -> Some (f v) + | None -> None |