comparison demo/metaform.ur @ 418:ad7e854a518c

Metaform demos, minus prose
author Adam Chlipala <adamc@hcoop.net>
date Thu, 23 Oct 2008 14:03:12 -0400
parents
children 6c4643880df5
comparison
equal deleted inserted replaced
417:e0e9e9eca1cb 418:ad7e854a518c
1 functor Make (M : sig
2 con fs :: {Unit}
3 val names : $(mapUT string fs)
4 end) = struct
5
6 fun handler values = return <xml><body>
7 {foldURX2 [string] [string] [body]
8 (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name value => <xml>
9 <li> {[name]} = {[value]}</li>
10 </xml>)
11 [M.fs] M.names values}
12 </body></xml>
13
14 fun main () = return <xml><body>
15 <form>
16 {foldUR [string] [fn cols :: {Unit} => xml form [] (mapUT string cols)]
17 (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name
18 (acc : xml form [] (mapUT string rest)) => <xml>
19 <li> {[name]}: <textbox{nm}/></li>
20 {useMore acc}
21 </xml>)
22 <xml/>
23 [M.fs] M.names}
24 <submit action={handler}/>
25 </form>
26 </body></xml>
27
28 end