comparison tests/caseMod.lac @ 177:5d030ee143e2

Case through corify
author Adam Chlipala <adamc@hcoop.net>
date Sat, 02 Aug 2008 11:15:32 -0400
parents 7ee424760d2f
children c0ea24dcb86f
comparison
equal deleted inserted replaced
176:33d4a8eea484 177:5d030ee143e2
7 datatype t = datatype M.t 7 datatype t = datatype M.t
8 8
9 val g = fn x : t => case x of M.A => B | B => M.A 9 val g = fn x : t => case x of M.A => B | B => M.A
10 10
11 structure N = struct 11 structure N = struct
12 datatype t = C of t | D 12 datatype u = C of t | D
13 end 13 end
14 14
15 val h = fn x : N.t => case x of N.C x => x | N.D => M.A 15 val h = fn x : N.u => case x of N.C x => x | N.D => M.A
16 16
17 datatype u = datatype N.t 17 datatype u = datatype N.u
18 18
19 val i = fn x : u => case x of N.C x => x | D => M.A 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 page = fn x => <html><body>
28 {cdata (toString x)}
29 </body></html>
30
31 val main : unit -> page = fn () => <html><body>
32 <li> <a link={page (C A)}>C A</a></li>
33 <li> <a link={page (C B)}>C B</a></li>
34 <li> <a link={page D}>D</a></li>
35 </body></html>