home
/
code
/
tiger.ml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Expose option module to the rest of the program
[tiger.ml.git]
/
compiler
/
src
/
lib
/
tiger
/
tiger_opt.ml
diff --git a/compiler/src/lib/tiger/tiger_opt.ml
b/compiler/src/lib/tiger/tiger_opt.ml
new file mode 100644
(file)
index 0000000..
cdacd0e
--- /dev/null
+++ b/
compiler/src/lib/tiger/tiger_opt.ml
@@ -0,0
+1,11
@@
+type 'a t = 'a option
+
+let map t f =
+ match t with
+ | None -> None
+ | Some x -> Some (f x)
+
+let get t ~default =
+ match t with
+ | None -> default
+ | Some x -> x
This page took
0.026991 seconds
and
4
git commands to generate.