Commit 987648c2 authored by POTTIER Francois's avatar POTTIER Francois

Added a somewhat unusual [Option.project].

parent 78277174
......@@ -18,3 +18,9 @@ let fold f o accu =
| Some x ->
f x accu
let project = function
| Some x ->
x
| None ->
(* Presumably, an error message has already been printed. *)
exit 1
val map: ('a -> 'b) -> 'a option -> 'b option
val iter: ('a -> unit) -> 'a option -> unit
val fold: ('a -> 'b -> 'b) -> 'a option -> 'b -> 'b
val project: 'a option -> 'a (* careful: calls [exit 1] in case of failure *)
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