annotate demo/treeFun.ur @ 1909:659d1f4e95bf

make dist: Use fewer wildcards The remaining ones only work by accident: http://www.gnu.org/software/automake/manual/html_node/Wildcards.html and they have some practical problems too (we don?t really want to distribute include/urweb/config.h or src/config.sml), but this is enough for now to pass ?make distcheck? as long as we don?t run it from a separate build directory. Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- Makefile.am | 6 +++--- src/c/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
author Anders Kaseorg <andersk@mit.edu>
date Fri, 22 Nov 2013 09:36:14 -0500
parents 311ca1ae715d
children
rev   line source
adamc@469 1 functor Make(M : sig
adamc@469 2 type key
adamc@469 3 con id :: Name
adamc@469 4 con parent :: Name
adamc@469 5 con cols :: {Type}
adamc@469 6 constraint [id] ~ [parent]
adamc@469 7 constraint [id, parent] ~ cols
adamc@469 8
adamc@723 9 val key_inj : sql_injectable_prim key
adamc@469 10
adamc@706 11 table tab : ([id = key, parent = option key] ++ cols)
adamc@469 12 end) = struct
adamc@469 13
adamc@469 14 open M
adamc@469 15
adamc@469 16 fun tree (f : $([id = key, parent = option key] ++ cols) -> xbody)
adamc@469 17 (root : option M.key) =
adamc@469 18 let
adamc@469 19 fun recurse (root : option key) =
adamc@471 20 queryX' (SELECT * FROM tab WHERE {eqNullable' (SQL tab.{parent}) root})
adamc@469 21 (fn r =>
adamc@469 22 children <- recurse (Some r.Tab.id);
adamc@469 23 return <xml>
adamc@469 24 <li> {f r.Tab}</li>
adamc@469 25
adamc@469 26 <ul>
adamc@469 27 {children}
adamc@469 28 </ul>
adamc@469 29 </xml>)
adamc@469 30 in
adamc@469 31 recurse root
adamc@469 32 end
adamc@469 33
adamc@469 34 end