comparison tests/gform.lac @ 147:eb16f2aadbe9

Meta-programming forms
author Adam Chlipala <adamc@hcoop.net>
date Tue, 22 Jul 2008 18:46:04 -0400
parents 80ac94b54e41
children 15e8b9775539
comparison
equal deleted inserted replaced
146:80ac94b54e41 147:eb16f2aadbe9
17 val handler = fn x : $(stringify M.rs) => <html><body> 17 val handler = fn x : $(stringify M.rs) => <html><body>
18 OK. 18 OK.
19 </body></html> 19 </body></html>
20 20
21 val page = fn () => <html><body> 21 val page = fn () => <html><body>
22 <lform>
23 {fold [fn rs :: {Unit} => xml lform [] (stringify rs)]
24 (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} =>
25 fn frag : xml lform [] (stringify rest) =>
26 <lform><li>{frag} <textbox{nm}/></li></lform>)
27 <lform></lform>
28 [rs]}
22 29
30 <submit action={handler}/>
31 </lform>
23 </body></html> 32 </body></html>
24 end 33 end
25 34
26 structure M = F(struct 35 structure M = F(struct
27 con rs = [] 36 con rs = [A, B, C]
28 end) 37 end)
29 38
30 open M 39 open M
31 40