Add option iter
[tiger.ml.git] / compiler / src / lib / tiger / tiger_opt.ml
CommitLineData
d1fe69d3
SK
1type 'a t = 'a option
2
3let map t f =
4 match t with
5 | None -> None
6 | Some x -> Some (f x)
7
eb9263c8
SK
8let iter t ~f =
9 ignore (map t f)
10
d1fe69d3
SK
11let get t ~default =
12 match t with
13 | None -> default
14 | Some x -> x
This page took 0.017139 seconds and 4 git commands to generate.