From: Stefano Zacchiroli Date: Tue, 25 Oct 2005 13:47:04 +0000 (+0000) Subject: added iter_option X-Git-Tag: V_0_7_2_3~194 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=0a0be269948344318ebbab5593b458aa95313df8;p=helm.git added iter_option --- diff --git a/helm/ocaml/extlib/hExtlib.ml b/helm/ocaml/extlib/hExtlib.ml index ceb9c8d8b..9f4f2d9c9 100644 --- a/helm/ocaml/extlib/hExtlib.ml +++ b/helm/ocaml/extlib/hExtlib.ml @@ -57,6 +57,7 @@ let profile = (** {2 Optional values} *) let map_option f = function None -> None | Some v -> Some (f v) +let iter_option f = function None -> () | Some v -> f v let unopt = function None -> failwith "unopt: None" | Some v -> v (** {2 String processing} *) diff --git a/helm/ocaml/extlib/hExtlib.mli b/helm/ocaml/extlib/hExtlib.mli index e40920350..32fb59d47 100644 --- a/helm/ocaml/extlib/hExtlib.mli +++ b/helm/ocaml/extlib/hExtlib.mli @@ -26,6 +26,7 @@ (** {2 Optional values} *) val map_option: ('a -> 'b) -> 'a option -> 'b option +val iter_option: ('a -> unit) -> 'a option -> unit val unopt: 'a option -> 'a (** @raise Failure *) (** {2 Filesystem} *)