]> matita.cs.unibo.it Git - pkg-cerco/acc.git/blob - src/utilities/option.ml
first version of the package
[pkg-cerco/acc.git] / src / utilities / option.ml
1 (* Pasted from Pottier's PP compiler *)
2
3 let map f = function
4   | None ->
5       None
6   | Some x ->
7       Some (f x)
8
9 let iter f = function
10   | None ->
11       ()
12   | Some x ->
13       f x
14
15 let fold f o accu =
16   match o with
17   | None ->
18       accu
19   | Some x ->
20       f x accu
21
22 let print printer () = function
23   | None ->
24       ""
25   | Some x ->
26       printer () x
27