summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-09 08:47:36 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-09 08:47:36 -0400
commitbd2d0fe6c8deedc88d985b2c38978b730ff0cd19 (patch)
tree2daf2365908cb5776cc09bcfc90146e1984efb6f /tests
parentb9b67597324deb6e6dfc8ef33c60c110abc2af7b (diff)
A multi-parameter datatype all the way through
Diffstat (limited to 'tests')
-rw-r--r--tests/datatypeP2.lac15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/datatypeP2.lac b/tests/datatypeP2.lac
new file mode 100644
index 00000000..09cc964a
--- /dev/null
+++ b/tests/datatypeP2.lac
@@ -0,0 +1,15 @@
+datatype sum a b = Left of a | Right of b
+
+val l : sum int string = Left 5
+val r : sum int string = Right "Hi"
+
+val show = fn x : sum int string => case x of Left _ => "Left _" | Right s => s
+
+val page = fn x => <html><body>
+ {cdata (show x)}
+</body></html>
+
+val main : unit -> page = fn () => <html><body>
+ <li><a link={page l}>Left</a></li>
+ <li><a link={page r}>Right</a></li>
+</body></html>