comparison tests/datatypeP.lac @ 193:8a70e2919e86

Specialization of single-parameter datatypes
author Adam Chlipala <adamc@hcoop.net>
date Fri, 08 Aug 2008 17:55:51 -0400
parents aa54250f58ac
children
comparison
equal deleted inserted replaced
192:9bbf4d383381 193:8a70e2919e86
6 val f = fn t ::: Type => fn x : option t => 6 val f = fn t ::: Type => fn x : option t =>
7 case x of None => None | Some x => Some (Some x) 7 case x of None => None | Some x => Some (Some x)
8 8
9 val none_again = f none 9 val none_again = f none
10 val some_1_again = f some_1 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>