Commit cd67c464 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Add [Option.value].

parent 4454ad47
......@@ -59,3 +59,10 @@ let hash hash = function
hash x
| None ->
Hashtbl.hash None
let value o ~default =
match o with
| Some x ->
x
| None ->
default
......@@ -18,3 +18,4 @@ val force: 'a option -> 'a
val project: 'a option -> 'a (* careful: calls [exit 1] in case of failure *)
val equal: ('a -> 'b -> bool) -> 'a option -> 'b option -> bool
val hash: ('a -> int) -> 'a option -> int
val value: 'a option -> default:'a -> 'a
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment