Mercurial > urweb
comparison demo/metaform.ur @ 823:669ac5e9a69e
Demo compiles with pattern-matching-fu
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 28 May 2009 10:35:25 -0400 |
parents | aa2290c32ce2 |
children | 8d3aa6c7cee0 |
comparison
equal
deleted
inserted
replaced
822:d4e811beb8eb | 823:669ac5e9a69e |
---|---|
4 val names : $(mapU string fs) | 4 val names : $(mapU string fs) |
5 end) = struct | 5 end) = struct |
6 | 6 |
7 fun handler values = return <xml><body> | 7 fun handler values = return <xml><body> |
8 {foldURX2 [string] [string] [body] | 8 {foldURX2 [string] [string] [body] |
9 (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name value => <xml> | 9 (fn [nm :: Name] [rest :: {Unit}] [[nm] ~ rest] name value => <xml> |
10 <li> {[name]} = {[value]}</li> | 10 <li> {[name]} = {[value]}</li> |
11 </xml>) | 11 </xml>) |
12 [M.fs] M.fl M.names values} | 12 [M.fs] M.fl M.names values} |
13 </body></xml> | 13 </body></xml> |
14 | 14 |
15 fun main () = return <xml><body> | 15 fun main () = return <xml><body> |
16 <form> | 16 <form> |
17 {foldUR [string] [fn cols :: {Unit} => xml form [] (mapU string cols)] | 17 {foldUR [string] [fn cols :: {Unit} => xml form [] (mapU string cols)] |
18 (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name | 18 (fn [nm :: Name] [rest :: {Unit}] [[nm] ~ rest] name |
19 (acc : xml form [] (mapU string rest)) => <xml> | 19 (acc : xml form [] (mapU string rest)) => <xml> |
20 <li> {[name]}: <textbox{nm}/></li> | 20 <li> {[name]}: <textbox{nm}/></li> |
21 {useMore acc} | 21 {useMore acc} |
22 </xml>) | 22 </xml>) |
23 <xml/> | 23 <xml/> |