diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-09-13 10:30:45 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-09-13 10:30:45 -0400 |
commit | 2ad30811b217c0880f8ea65a7da0f755ec0cf9e6 (patch) | |
tree | a8c55c74f05acc784c8d0afb9237d867b0e3e680 /tests | |
parent | a12b7d5677662153dd69c14945c0d88f447425a3 (diff) |
foldTR2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/crud.ur | 17 | ||||
-rw-r--r-- | tests/crud.urs | 3 |
2 files changed, 11 insertions, 9 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>; diff --git a/tests/crud.urs b/tests/crud.urs index c021bea3..4741af00 100644 --- a/tests/crud.urs +++ b/tests/crud.urs @@ -1,4 +1,5 @@ -con colMeta = fn cols :: {Type} => $(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} |