diff tests/caseMod.ur @ 244:71bafe66dbe1

Laconic -> Ur
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 08:32:18 -0400
parents tests/caseMod.lac@c0ea24dcb86f
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/caseMod.ur	Sun Aug 31 08:32:18 2008 -0400
@@ -0,0 +1,38 @@
+structure M = struct
+        datatype t = A | B
+end
+
+val f = fn x : M.t => case x of M.A => M.B | M.B => M.A
+
+datatype t = datatype M.t
+
+val g = fn x : t => case x of M.A => B | B => M.A
+
+structure N = struct
+        datatype u = C of t | D
+end
+
+val h = fn x : N.u => case x of N.C x => x | N.D => M.A
+
+datatype u = datatype N.u
+
+val i = fn x : u => case x of N.C x => x | D => M.A
+
+val toString = fn x =>
+        case x of
+            C A => "C A"
+          | C B => "C B"
+          | D => "D"
+
+val rec page = fn x => <html><body>
+        {cdata (toString x)}<br/>
+        <br/>
+
+        <a link={page x}>Again!</a>
+</body></html>
+
+val main : unit -> page = fn () => <html><body>
+        <li> <a link={page (C A)}>C A</a></li>
+        <li> <a link={page (C B)}>C B</a></li>
+        <li> <a link={page D}>D</a></li>
+</body></html>