summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-08-22 12:55:18 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-08-22 12:55:18 -0400
commitf79732bbf16467ecf40c6068bac93502aa49e9d2 (patch)
tree1d7e3ef3f5bbca99b53ac3ee3b66d934c22f1d0d /lib
parent28f2c29dd98659f00e4d7bc3147c2fc2e5320f34 (diff)
Convert to requiring explicit 'rpc' marker
Diffstat (limited to 'lib')
-rw-r--r--lib/ur/basis.urs2
-rw-r--r--lib/ur/list.ur7
-rw-r--r--lib/ur/list.urs5
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 7f06a47a..9f5a9b97 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -125,6 +125,8 @@ val alert : string -> transaction unit
val spawn : transaction unit -> transaction unit
val sleep : int -> transaction unit
+val rpc : t ::: Type -> transaction t -> transaction t
+
(** Channels *)
diff --git a/lib/ur/list.ur b/lib/ur/list.ur
index d774cc54..3d4134ea 100644
--- a/lib/ur/list.ur
+++ b/lib/ur/list.ur
@@ -217,6 +217,13 @@ fun app [m] (_ : monad m) [a] f =
app'
end
+fun mapQuery [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type]
+ [tables ~ exps] (q : sql_query tables exps)
+ (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> t) =
+ query q
+ (fn fs acc => return (f fs :: acc))
+ []
+
fun assoc [a] [b] (_ : eq a) (x : a) =
let
fun assoc' (ls : list (a * b)) =
diff --git a/lib/ur/list.urs b/lib/ur/list.urs
index 1b0fced9..ece85e8c 100644
--- a/lib/ur/list.urs
+++ b/lib/ur/list.urs
@@ -43,6 +43,11 @@ val all : a ::: Type -> (a -> bool) -> t a -> bool
val app : m ::: (Type -> Type) -> monad m -> a ::: Type
-> (a -> m unit) -> t a -> m unit
+val mapQuery : tables ::: {{Type}} -> exps ::: {Type} -> t ::: Type
+ -> [tables ~ exps] =>
+ sql_query tables exps
+ -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) -> t)
+ -> transaction (list t)
(** Association lists *)