summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2015-11-22 10:39:36 -0500
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2015-11-22 10:39:36 -0500
commitbf037ce78c2c76a34ecca0fb8bafa5d5be38968a (patch)
tree3e91b0d0e8e0fb704c7df444283b6c8c63351f95 /lib/ur
parent7d861ea0debf944cb8e3e38d73a8c0197de574b3 (diff)
parent638e838a81e1ccc6594fda1920df441eb21577ae (diff)
Merge branch 'upstream' into dfsg_clean20151122+dfsg
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/basis.urs4
-rw-r--r--lib/ur/monad.ur9
-rw-r--r--lib/ur/monad.urs6
3 files changed, 19 insertions, 0 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index ec6ef599..a4872c32 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -163,6 +163,7 @@ val toSeconds : time -> int
val diffInSeconds : time -> time -> int
(* Earlier time first *)
val toMilliseconds : time -> int
+val fromMilliseconds : int -> time
val diffInMilliseconds : time -> time -> int
val timef : string -> time -> string (* Uses strftime() format string *)
val readUtc : string -> option time
@@ -553,6 +554,9 @@ val sql_div : t ::: Type -> sql_arith t -> sql_binary t t t
val sql_mod : sql_binary int int int
val sql_eq : t ::: Type -> sql_binary t t bool
+(* Note that the semantics of this operator on nullable types are different than for standard SQL!
+ * Instead, we do it the sane way, where [NULL = NULL]. *)
+
val sql_ne : t ::: Type -> sql_binary t t bool
val sql_lt : t ::: Type -> sql_binary t t bool
val sql_le : t ::: Type -> sql_binary t t bool
diff --git a/lib/ur/monad.ur b/lib/ur/monad.ur
index ab7742fe..8bff0133 100644
--- a/lib/ur/monad.ur
+++ b/lib/ur/monad.ur
@@ -81,6 +81,15 @@ fun mapR2 [K] [m] (_ : monad m) [tf1 :: K -> Type] [tf2 :: K -> Type] [tr :: K -
return (acc ++ {nm = v'}))
{}
+fun mapR3 [K] [m] (_ : monad m) [tf1 :: K -> Type] [tf2 :: K -> Type] [tf3 :: K -> Type] [tr :: K -> Type]
+ (f : nm :: Name -> t :: K -> tf1 t -> tf2 t -> tf3 t -> m (tr t)) =
+ @@foldR3 [m] _ [tf1] [tf2] [tf3] [fn r => $(map tr r)]
+ (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] (v1 : tf1 t) (v2 : tf2 t) (v3 : tf3 t)
+ (acc : $(map tr rest)) =>
+ v' <- f [nm] [t] v1 v2 v3;
+ return (acc ++ {nm = v'}))
+ {}
+
fun foldMapR [K] [m] (_ : monad m) [tf :: K -> Type] [tf' :: K -> Type] [tr :: {K} -> Type]
(f : nm :: Name -> t :: K -> rest :: {K}
-> [[nm] ~ rest] =>
diff --git a/lib/ur/monad.urs b/lib/ur/monad.urs
index ce823f4a..8ca8d0a3 100644
--- a/lib/ur/monad.urs
+++ b/lib/ur/monad.urs
@@ -58,6 +58,12 @@ val mapR2 : K --> m ::: (Type -> Type) -> monad m
-> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> m (tr t))
-> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> m ($(map tr r))
+val mapR3 : K --> m ::: (Type -> Type) -> monad m
+ -> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type)
+ -> tr :: (K -> Type)
+ -> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> tf3 t -> m (tr t))
+ -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> m ($(map tr r))
+
val foldMapR : K --> m ::: (Type -> Type) -> monad m
-> tf :: (K -> Type)
-> tf' :: (K -> Type)