Mercurial > urweb
comparison tests/datatypeP.ur @ 244:71bafe66dbe1
Laconic -> Ur
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 08:32:18 -0400 |
parents | tests/datatypeP.lac@8a70e2919e86 |
children |
comparison
equal
deleted
inserted
replaced
243:2b9dfaffb008 | 244:71bafe66dbe1 |
---|---|
1 datatype option a = None | Some of a | |
2 | |
3 val none : option int = None | |
4 val some_1 : option int = Some 1 | |
5 | |
6 val f = fn t ::: Type => fn x : option t => | |
7 case x of None => None | Some x => Some (Some x) | |
8 | |
9 val none_again = f none | |
10 val some_1_again = f some_1 | |
11 | |
12 val show = fn t ::: Type => fn x : option t => case x of None => "None" | Some _ => "Some" | |
13 | |
14 val page = fn x => <html><body> | |
15 {cdata (show x)} | |
16 </body></html> | |
17 | |
18 val main : unit -> page = fn () => <html><body> | |
19 <li><a link={page none_again}>None</a></li> | |
20 <li><a link={page some_1_again}>Some 1</a></li> | |
21 </body></html> |