summaryrefslogtreecommitdiff
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r--lib/ur/top.ur20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index e831b4f7..6c6c896c 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -225,15 +225,23 @@ fun query1' [t ::: Name] [fs ::: {Type}] [state ::: Type] (q : sql_query [] [] [
(f : $fs -> state -> state) (i : state) =
query q (fn r s => return (f r.t s)) i
+val rev = fn [a] =>
+ let
+ fun rev' acc (ls : list a) =
+ case ls of
+ [] => acc
+ | x :: ls => rev' (x :: acc) ls
+ in
+ rev' []
+ end
+
fun queryL [tables] [exps] [tables ~ exps] (q : sql_query [] [] tables exps) =
- query q
- (fn r ls => return (r :: ls))
- []
+ ls <- query q (fn r ls => return (r :: ls)) [];
+ return (rev ls)
fun queryL1 [t ::: Name] [fs ::: {Type}] (q : sql_query [] [] [t = fs] []) =
- query q
- (fn r ls => return (r.t :: ls))
- []
+ ls <- query q (fn r ls => return (r.t :: ls)) [];
+ return (rev ls)
fun queryI [tables ::: {{Type}}] [exps ::: {Type}]
[tables ~ exps] (q : sql_query [] [] tables exps)