summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@csail.mit.edu>2016-07-01 11:10:35 -0400
committerGravatar Adam Chlipala <adamc@csail.mit.edu>2016-07-01 11:10:35 -0400
commit10f0c953a1de12f375d694a0ee0816f7dffa4483 (patch)
treeb662e018bd425048b1ac601df9c71a2f890a0431 /lib/ur
parent0be44023bd10e455af60a4e89ada6731e3426874 (diff)
Switch to expected order for [queryL]
Diffstat (limited to 'lib/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)