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) = returnAre you sure you want to delete ID #{txt _ id}?
fun main () : transaction page = rows <- queryX (SELECT * FROM tab AS T) (fn (fs : {T : $([Id = int] ++ M.cols)}) =>ID | {foldTRX [colMeta'] [tr] (fn (nm :: Name) (t :: Type) (rest :: {Type}) => [[nm] ~ rest] => fn col =>
---|
{cdata col.Nam} |