From 0a0be269948344318ebbab5593b458aa95313df8 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Tue, 25 Oct 2005 13:47:04 +0000 Subject: [PATCH] added iter_option --- helm/ocaml/extlib/hExtlib.ml | 1 + helm/ocaml/extlib/hExtlib.mli | 1 + 2 files changed, 2 insertions(+) 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} *) -- 2.39.2