Mercurial > urweb
comparison tests/espec.ur @ 1077:a3273bee05a9
Initial generalization of Especialize, with security bug known
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 15 Dec 2009 12:26:00 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1076:dcf98ae3c48d | 1077:a3273bee05a9 |
---|---|
1 fun foo (wrap : xbody -> transaction page) = wrap <xml> | |
2 <a link={foo wrap}>Foo</a> | |
3 </xml> | |
4 | |
5 fun bar (wrap : xbody -> transaction page) (n : int) = wrap <xml> | |
6 <a link={bar wrap n}>Bar</a>; {[n]} | |
7 </xml> | |
8 | |
9 fun baz (n : int) (wrap : xbody -> transaction page) = wrap <xml> | |
10 <a link={baz n wrap}>Baz</a>; {[n]} | |
11 </xml> | |
12 | |
13 fun middle (n : int) (wrap : xbody -> transaction page) (m : int) = wrap <xml> | |
14 <a link={middle n wrap m}>Middle</a>; {[n]}; {[m]} | |
15 </xml> | |
16 | |
17 fun crazy (f : int -> int) (b : bool) (wrap : xbody -> transaction page) (m : int) = wrap <xml> | |
18 <a link={crazy f b wrap m}>Crazy</a>; {[b]}; {[f m]} | |
19 </xml> | |
20 | |
21 fun wild (q : bool) (f : int -> int) (n : float) (wrap : xbody -> transaction page) (m : int) = wrap <xml> | |
22 <a link={wild q f n wrap m}>Wild</a>; {[n]}; {[f m]}; {[q]} | |
23 </xml> | |
24 | |
25 fun wrap x = return <xml><body>{x}</body></xml> | |
26 | |
27 fun wrapN n x = return <xml><body>{[n]}; {x}</body></xml> | |
28 | |
29 fun foo2 (wrap : xbody -> transaction page) = wrap <xml> | |
30 <a link={foo2 wrap}>Foo</a> | |
31 </xml> | |
32 | |
33 fun foo3 (n : int) = wrap <xml> | |
34 <a link={foo2 (wrapN n)}>Foo</a> | |
35 </xml> | |
36 | |
37 fun bar2 (n : int) (wrap : xbody -> transaction page) = wrap <xml> | |
38 <a link={bar2 n wrap}>Bar</a>; n={[n]} | |
39 </xml> | |
40 | |
41 fun bar3 (n : int) = wrap <xml> | |
42 <a link={bar2 88 (wrapN n)}>Bar</a> | |
43 </xml> | |
44 | |
45 | |
46 fun main () = return <xml><body> | |
47 <a link={foo wrap}>Foo</a> | |
48 <a link={bar wrap 32}>Bar</a> | |
49 <a link={baz 18 wrap}>Baz</a> | |
50 <a link={middle 1 wrap 2}>Middle</a> | |
51 <a link={crazy (fn n => 2 * n) False wrap 2}>Crazy</a> | |
52 <a link={wild True (fn n => 2 * n) 1.23 wrap 2}>Wild</a> | |
53 <hr/> | |
54 <a link={foo3 15}>Foo3</a> | |
55 <a link={bar3 44}>Bar3</a> | |
56 </body></xml> |