5 ms·
Whoa, this is pretty horrifying: app code, queries and markup all mixed together, like typed-checked PHP. I know this is just a demo but "separation of concerns
by kyllo 12y ago
Whoa, this is pretty horrifying: app code, queries and markup all mixed together, like typed-checked PHP. I know this is just a demo but "separation of concerns" does not appear to have been a concern.
fun list () =
rows <- queryX (SELECT * FROM tab AS T)
(fn (fs : {T : $([Id = int] ++ map fst M.cols)}) => <xml>
<tr>
<td>{[fs.T.Id]}</td>
{@mapX2 [fst] [colMeta] [tr]
(fn [nm :: Name] [t ::_] [rest ::_] [[nm] ~ rest] v col => <xml>
<td>{col.Show v}</td>
</xml>)
M.fl (fs.T -- #Id) M.cols}
<td>
<a link={upd fs.T.Id}>[Update]</a>
<a link={confirm fs.T.Id}>[Delete]</a>
</td>
</tr>
</xml>);