Mercurial > urweb
comparison tests/caseFfi.ur @ 244:71bafe66dbe1
Laconic -> Ur
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 08:32:18 -0400 |
parents | tests/caseFfi.lac@19ee24bffbc0 |
children |
comparison
equal
deleted
inserted
replaced
243:2b9dfaffb008 | 244:71bafe66dbe1 |
---|---|
1 extern structure M : sig | |
2 datatype t = A | B | |
3 datatype u = C of t | D | |
4 end | |
5 | |
6 val f = fn x => case x of M.A => M.B | M.B => M.A | |
7 | |
8 val t2s = fn x => case x of M.A => "A" | M.B => "B" | |
9 | |
10 val g = fn x => case x of M.C a => M.C (f a) | M.D => M.C M.A | |
11 | |
12 val u2s = fn x => case x of M.C a => t2s a | M.D => "D" | |
13 | |
14 val page = fn x => <html><body> | |
15 {cdata (t2s x)} | |
16 </body></html> | |
17 | |
18 val page2 = fn x => <html><body> | |
19 {cdata (u2s x)} | |
20 </body></html> | |
21 | |
22 val main : unit -> page = fn () => <html><body> | |
23 <li><a link={page M.A}>A</a></li> | |
24 <li><a link={page M.B}>B</a></li> | |
25 <li><a link={page2 (M.C M.A)}>C A</a></li> | |
26 <li><a link={page2 (M.C M.B)}>C B</a></li> | |
27 <li><a link={page2 M.D}>D</a></li> | |
28 </body></html> |