summaryrefslogtreecommitdiff
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2016-08-05 20:06:17 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2016-08-05 20:06:17 -0400
commitc921d0df325c803fed8c7742eb088cb3d030d541 (patch)
tree16d374660aa9adb92c2f08317a20d61ae995ef9a /lib/ur/top.ur
parenta3e471e933945dcfb54873cb20c691a193b55671 (diff)
parentbd6f549a527856db3878f1586c6666646a45d8ee (diff)
Merge branch 'upstream' into dfsg_clean20160805+dfsg
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)