con colMeta' = fn t :: Type => {Show : t -> xbody} con colMeta = fn cols :: {Type} => $(Top.mapTT colMeta' cols) functor Make(M : sig con cols :: {Type} constraint [Id] ~ cols val tab : sql_table ([Id = int] ++ cols) val title : string val cols : colMeta cols end) = struct open constraints M val tab = M.tab fun list () = rows <- query (SELECT * FROM tab AS T) (fn (fs : {T : $([Id = int] ++ M.cols)}) acc => return {acc} {txt _ fs.T.Id} {foldTRX2 [idT] [colMeta'] [tr] (fn (nm :: Name) (t :: Type) (rest :: {Type}) => [[nm] ~ rest] => fn v funcs => {funcs.Show v} ) [M.cols] (fs.T -- #Id) M.cols} ) ; return List

List

{rows}
ID
fun main () : transaction page = return {cdata M.title}

{cdata M.title}

  • List all rows
  • end