comparison demo/batchFun.ur @ 1172:ad15700272f6

Changing foldRX to mapX
author Adam Chlipala <adamc@hcoop.net>
date Sun, 28 Feb 2010 13:06:10 -0500
parents 8d3aa6c7cee0
children d008c4c43a0a
comparison
equal deleted inserted replaced
1171:7a2a7a8f9cab 1172:ad15700272f6
70 case ls of 70 case ls of
71 Nil => <xml/> 71 Nil => <xml/>
72 | Cons (r, ls) => <xml> 72 | Cons (r, ls) => <xml>
73 <tr> 73 <tr>
74 <td>{[r.Id]}</td> 74 <td>{[r.Id]}</td>
75 {@foldRX2 [colMeta] [fst] [_] 75 {@mapX2 [colMeta] [fst] [_]
76 (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}] 76 (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}]
77 [[nm] ~ rest] m v => 77 [[nm] ~ rest] m v =>
78 <xml><td>{m.Show v}</td></xml>) 78 <xml><td>{m.Show v}</td></xml>)
79 M.fl M.cols (r -- #Id)} 79 M.fl M.cols (r -- #Id)}
80 {if withDel then 80 {if withDel then
86 </xml> 86 </xml>
87 in 87 in
88 <xml><dyn signal={ls <- signal lss; return <xml><table> 88 <xml><dyn signal={ls <- signal lss; return <xml><table>
89 <tr> 89 <tr>
90 <th>Id</th> 90 <th>Id</th>
91 {@foldRX [colMeta] [_] 91 {@mapX [colMeta] [_]
92 (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}] 92 (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}]
93 [[nm] ~ rest] m => 93 [[nm] ~ rest] m =>
94 <xml><th>{[m.Nam]}</th></xml>) 94 <xml><th>{[m.Nam]}</th></xml>)
95 M.fl M.cols} 95 M.fl M.cols}
96 </tr> 96 </tr>
142 142
143 <h2>Batch new rows to add</h2> 143 <h2>Batch new rows to add</h2>
144 144
145 <table> 145 <table>
146 <tr> <th>Id:</th> <td><ctextbox source={id}/></td> </tr> 146 <tr> <th>Id:</th> <td><ctextbox source={id}/></td> </tr>
147 {@foldRX2 [colMeta] [snd] [_] 147 {@mapX2 [colMeta] [snd] [_]
148 (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}] 148 (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}]
149 [[nm] ~ rest] m s => 149 [[nm] ~ rest] m s =>
150 <xml><tr> <th>{[m.Nam]}:</th> <td>{m.Widget s}</td> </tr></xml>) 150 <xml><tr> <th>{[m.Nam]}:</th> <td>{m.Widget s}</td> </tr></xml>)
151 M.fl M.cols inps} 151 M.fl M.cols inps}
152 <tr> <th/> <td><button value="Batch it" onclick={add ()}/></td> </tr> 152 <tr> <th/> <td><button value="Batch it" onclick={add ()}/></td> </tr>