Mercurial > urweb
annotate demo/metaform.ur @ 1205:7cd11380cdf1
WHERE-dependent checking
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 04 Apr 2010 17:18:41 -0400 |
parents | 51e596feec37 |
children | d008c4c43a0a |
rev | line source |
---|---|
adamc@418 | 1 functor Make (M : sig |
adamc@418 | 2 con fs :: {Unit} |
adamc@632 | 3 val fl : folder fs |
adamc@643 | 4 val names : $(mapU string fs) |
adamc@418 | 5 end) = struct |
adamc@418 | 6 |
adamc@418 | 7 fun handler values = return <xml><body> |
adamc@1176 | 8 {@mapUX2 [string] [string] [body] |
adamc@1093 | 9 (fn [nm :: Name] [rest :: {Unit}] [[nm] ~ rest] name value => <xml> |
adamc@1093 | 10 <li> {[name]} = {[value]}</li> |
adamc@1093 | 11 </xml>) |
adamc@1093 | 12 M.fl M.names values} |
adamc@418 | 13 </body></xml> |
adamc@418 | 14 |
adamc@418 | 15 fun main () = return <xml><body> |
adamc@418 | 16 <form> |
adamc@1093 | 17 {@foldUR [string] [fn cols :: {Unit} => xml form [] (mapU string cols)] |
adamc@1093 | 18 (fn [nm :: Name] [rest :: {Unit}] [[nm] ~ rest] name |
adamc@1093 | 19 (acc : xml form [] (mapU string rest)) => <xml> |
adamc@1093 | 20 <li> {[name]}: <textbox{nm}/></li> |
adamc@1093 | 21 {useMore acc} |
adamc@1093 | 22 </xml>) |
adamc@1093 | 23 <xml/> |
adamc@1093 | 24 M.fl M.names} |
adamc@418 | 25 <submit action={handler}/> |
adamc@418 | 26 </form> |
adamc@418 | 27 </body></xml> |
adamc@418 | 28 |
adamc@418 | 29 end |