summaryrefslogtreecommitdiff
path: root/tests/crud.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-09-13 10:30:45 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-09-13 10:30:45 -0400
commit2ad30811b217c0880f8ea65a7da0f755ec0cf9e6 (patch)
treea8c55c74f05acc784c8d0afb9237d867b0e3e680 /tests/crud.ur
parenta12b7d5677662153dd69c14945c0d88f447425a3 (diff)
foldTR2
Diffstat (limited to 'tests/crud.ur')
-rw-r--r--tests/crud.ur17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/crud.ur b/tests/crud.ur
index c3e76e6a..3837061e 100644
--- a/tests/crud.ur
+++ b/tests/crud.ur
@@ -1,4 +1,5 @@
-con colMeta = fn cols :: {Type} => $(Top.mapTT (fn t => {Show : t -> xbody}) cols)
+con colMeta' = fn t :: Type => {Show : t -> xbody}
+con colMeta = fn cols :: {Type} => $(Top.mapTT colMeta' cols)
functor Make(M : sig
con cols :: {Type}
@@ -15,19 +16,19 @@ val tab = M.tab
fun list () =
rows <- query (SELECT * FROM tab AS T)
- (fn fs acc => return <body>
+ (fn (fs : {T : $([Id = int] ++ M.cols)}) acc => return <body>
{acc}
<tr>
<td>{txt _ fs.T.Id}</td>
- {fold [fn cols :: {Type} => $cols -> colMeta cols -> xtr]
- (fn (nm :: Name) (t :: Type) (rest :: {Type}) acc =>
+ {foldTR2 [idT] [colMeta'] [fn _ => xtr]
+ (fn (nm :: Name) (t :: Type) (rest :: {Type}) =>
[[nm] ~ rest] =>
- fn r cols =>
+ fn v funcs acc =>
<tr>
- <td>{cols.nm.Show r.nm}</td>
- {acc (r -- nm) (cols -- nm)}
+ <td>{funcs.Show v}</td>
+ {acc}
</tr>)
- (fn _ _ => <tr></tr>)
+ <tr></tr>
[M.cols] (fs.T -- #Id) M.cols}
</tr>
</body>) <body></body>;