comparison 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
comparison
equal deleted inserted replaced
243:2b9dfaffb008 244:71bafe66dbe1
1 structure M = struct
2 datatype t = A | B
3 end
4
5 val f = fn x : M.t => case x of M.A => M.B | M.B => M.A
6
7 datatype t = datatype M.t
8
9 val g = fn x : t => case x of M.A => B | B => M.A
10
11 structure N = struct
12 datatype u = C of t | D
13 end
14
15 val h = fn x : N.u => case x of N.C x => x | N.D => M.A
16
17 datatype u = datatype N.u
18
19 val i = fn x : u => case x of N.C x => x | D => M.A
20
21 val toString = fn x =>
22 case x of
23 C A => "C A"
24 | C B => "C B"
25 | D => "D"
26
27 val rec page = fn x => <html><body>
28 {cdata (toString x)}<br/>
29 <br/>
30
31 <a link={page x}>Again!</a>
32 </body></html>
33
34 val main : unit -> page = fn () => <html><body>
35 <li> <a link={page (C A)}>C A</a></li>
36 <li> <a link={page (C B)}>C B</a></li>
37 <li> <a link={page D}>D</a></li>
38 </body></html>