annotate demo/metaform.ur @ 441:c5335613f31e

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