annotate 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
rev   line source
adamc@185 1 extern structure M : sig
adamc@185 2 datatype t = A | B
adamc@185 3 datatype u = C of t | D
adamc@185 4 end
adamc@185 5
adamc@185 6 val f = fn x => case x of M.A => M.B | M.B => M.A
adamc@185 7
adamc@185 8 val t2s = fn x => case x of M.A => "A" | M.B => "B"
adamc@185 9
adamc@185 10 val g = fn x => case x of M.C a => M.C (f a) | M.D => M.C M.A
adamc@185 11
adamc@185 12 val u2s = fn x => case x of M.C a => t2s a | M.D => "D"
adamc@185 13
adamc@185 14 val page = fn x => <html><body>
adamc@185 15 {cdata (t2s x)}
adamc@185 16 </body></html>
adamc@185 17
adamc@185 18 val page2 = fn x => <html><body>
adamc@185 19 {cdata (u2s x)}
adamc@185 20 </body></html>
adamc@185 21
adamc@185 22 val main : unit -> page = fn () => <html><body>
adamc@185 23 <li><a link={page M.A}>A</a></li>
adamc@185 24 <li><a link={page M.B}>B</a></li>
adamc@185 25 <li><a link={page2 (M.C M.A)}>C A</a></li>
adamc@185 26 <li><a link={page2 (M.C M.B)}>C B</a></li>
adamc@185 27 <li><a link={page2 M.D}>D</a></li>
adamc@185 28 </body></html>