Mercurial > urweb
comparison tests/option.ur @ 244:71bafe66dbe1
Laconic -> Ur
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 08:32:18 -0400 |
parents | tests/option.lac@ab86aa858e6c |
children | 77a28e7430bf |
comparison
equal
deleted
inserted
replaced
243:2b9dfaffb008 | 244:71bafe66dbe1 |
---|---|
1 datatype option a = None | Some of a | |
2 | |
3 val none_Hi : option string = None | |
4 val some_Hi = Some "Hi" | |
5 val none_some_Hi : option (option string) = None | |
6 val some_some_Hi = Some some_Hi | |
7 | |
8 val show = fn x => case x of None => "None" | Some x => x | |
9 | |
10 val show2 = fn x => case x of None => "None'" | Some x => show x | |
11 | |
12 val page = fn x => <html><body> | |
13 {cdata (show x)} | |
14 </body></html> | |
15 | |
16 val page2 = fn x => <html><body> | |
17 {cdata (show2 x)} | |
18 </body></html> | |
19 | |
20 val main : unit -> page = fn () => <html><body> | |
21 <li><a link={page none_Hi}>None1</a></li> | |
22 <li><a link={page some_Hi}>Some1</a></li> | |
23 <li><a link={page2 none_some_Hi}>None2</a></li> | |
24 <li><a link={page2 some_some_Hi}>Some2</a></li> | |
25 </body></html> |