Mercurial > urweb
annotate tests/caseMod.lac @ 180:c7a5c8e0a0e0
Cjrize EStrcat
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 03 Aug 2008 11:03:35 -0400 |
parents | 5d030ee143e2 |
children | c0ea24dcb86f |
rev | line source |
---|---|
adamc@174 | 1 structure M = struct |
adamc@174 | 2 datatype t = A | B |
adamc@174 | 3 end |
adamc@174 | 4 |
adamc@174 | 5 val f = fn x : M.t => case x of M.A => M.B | M.B => M.A |
adamc@174 | 6 |
adamc@174 | 7 datatype t = datatype M.t |
adamc@174 | 8 |
adamc@174 | 9 val g = fn x : t => case x of M.A => B | B => M.A |
adamc@174 | 10 |
adamc@174 | 11 structure N = struct |
adamc@177 | 12 datatype u = C of t | D |
adamc@174 | 13 end |
adamc@174 | 14 |
adamc@177 | 15 val h = fn x : N.u => case x of N.C x => x | N.D => M.A |
adamc@174 | 16 |
adamc@177 | 17 datatype u = datatype N.u |
adamc@174 | 18 |
adamc@174 | 19 val i = fn x : u => case x of N.C x => x | D => M.A |
adamc@177 | 20 |
adamc@177 | 21 val toString = fn x => |
adamc@177 | 22 case x of |
adamc@177 | 23 C A => "C A" |
adamc@177 | 24 | C B => "C B" |
adamc@177 | 25 | D => "D" |
adamc@177 | 26 |
adamc@177 | 27 val page = fn x => <html><body> |
adamc@177 | 28 {cdata (toString x)} |
adamc@177 | 29 </body></html> |
adamc@177 | 30 |
adamc@177 | 31 val main : unit -> page = fn () => <html><body> |
adamc@177 | 32 <li> <a link={page (C A)}>C A</a></li> |
adamc@177 | 33 <li> <a link={page (C B)}>C B</a></li> |
adamc@177 | 34 <li> <a link={page D}>D</a></li> |
adamc@177 | 35 </body></html> |