summaryrefslogtreecommitdiff
path: root/tests/option.lac
diff options
context:
space:
mode:
Diffstat (limited to 'tests/option.lac')
-rw-r--r--tests/option.lac25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/option.lac b/tests/option.lac
new file mode 100644
index 00000000..76fcc6ea
--- /dev/null
+++ b/tests/option.lac
@@ -0,0 +1,25 @@
+datatype option a = None | Some of a
+
+val none_Hi : option string = None
+val some_Hi = Some "Hi"
+val none_some_Hi : option (option string) = None
+val some_some_Hi = Some some_Hi
+
+val show = fn x => case x of None => "None" | Some x => x
+
+val show2 = fn x => case x of None => "None'" | Some x => show x
+
+val page = fn x => <html><body>
+ {cdata (show x)}
+</body></html>
+
+val page2 = fn x => <html><body>
+ {cdata (show2 x)}
+</body></html>
+
+val main : unit -> page = fn () => <html><body>
+ <li><a link={page none_Hi}>None1</a></li>
+ <li><a link={page some_Hi}>Some1</a></li>
+ <li><a link={page2 none_some_Hi}>None2</a></li>
+ <li><a link={page2 some_some_Hi}>Some2</a></li>
+</body></html>