con colMeta' = fn t :: Type => {Nam : string, 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 delete (id : int) = () <- dml (DELETE FROM tab WHERE Id = {id}); return The deed is done. fun confirm (id : int) = return

Are you sure you want to delete ID #{txt _ id}?

I was born sure!

fun main () : transaction page = rows <- queryX (SELECT * FROM tab AS T) (fn (fs : {T : $([Id = int] ++ M.cols)}) => {txt _ fs.T.Id} {foldTRX2 [idT] [colMeta'] [tr] (fn (nm :: Name) (t :: Type) (rest :: {Type}) => [[nm] ~ rest] => fn v col => {col.Show v} ) [M.cols] (fs.T -- #Id) M.cols} [Delete] ); return {cdata M.title}

{cdata M.title}

{foldTRX [colMeta'] [tr] (fn (nm :: Name) (t :: Type) (rest :: {Type}) => [[nm] ~ rest] => fn col => ) [M.cols] M.cols} {rows}
ID
{cdata col.Nam}
end