comparison demo/crud.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 e8d68fd8ed4b
comparison
equal deleted inserted replaced
1171:7a2a7a8f9cab 1172:ad15700272f6
48 fun list () = 48 fun list () =
49 rows <- queryX (SELECT * FROM tab AS T) 49 rows <- queryX (SELECT * FROM tab AS T)
50 (fn (fs : {T : $([Id = int] ++ map fst M.cols)}) => <xml> 50 (fn (fs : {T : $([Id = int] ++ map fst M.cols)}) => <xml>
51 <tr> 51 <tr>
52 <td>{[fs.T.Id]}</td> 52 <td>{[fs.T.Id]}</td>
53 {@foldRX2 [fst] [colMeta] [tr] 53 {@mapX2 [fst] [colMeta] [tr]
54 (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] 54 (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}]
55 [[nm] ~ rest] v col => <xml> 55 [[nm] ~ rest] v col => <xml>
56 <td>{col.Show v}</td> 56 <td>{col.Show v}</td>
57 </xml>) 57 </xml>)
58 M.fl (fs.T -- #Id) M.cols} 58 M.fl (fs.T -- #Id) M.cols}
64 </xml>); 64 </xml>);
65 return <xml> 65 return <xml>
66 <table border={1}> 66 <table border={1}>
67 <tr> 67 <tr>
68 <th>ID</th> 68 <th>ID</th>
69 {@foldRX [colMeta] [tr] 69 {@mapX [colMeta] [tr]
70 (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] 70 (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}]
71 [[nm] ~ rest] col => <xml> 71 [[nm] ~ rest] col => <xml>
72 <th>{cdata col.Nam}</th> 72 <th>{cdata col.Nam}</th>
73 </xml>) 73 </xml>)
74 M.fl M.cols} 74 M.fl M.cols}