aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2015-06-03 09:55:37 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2015-06-03 09:55:37 -0400
commitc87bb7427ff06f241ec33c970d9f2e2762c0cbe4 (patch)
tree29c51458649dd81ac7c8e7f98b2e98d4108d4204 /lib/ur
parent667321ef5eb38e7cfbf5ce52010e9c95dc5f6874 (diff)
Adjust new [assert] to work properly from top.ur
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/top.ur2
-rw-r--r--lib/ur/top.urs9
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 06dcab5f..e831b4f7 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -412,4 +412,4 @@ fun min [t] ( _ : ord t) (x : t) (y : t) : t =
if x < y then x else y
fun assert [a] (cond: bool) (msg: string) (loc: string) (x:a): a =
- if cond then x else error <xml>{[msg]} at {[loc]}</xml>
+ if cond then x else error <xml>{txt msg} at {txt loc}</xml>
diff --git a/lib/ur/top.urs b/lib/ur/top.urs
index 15bc6a22..907b28b2 100644
--- a/lib/ur/top.urs
+++ b/lib/ur/top.urs
@@ -35,7 +35,7 @@ con snd3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.2
con thd3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.3
(* Convert a record of n Units into a type-level record where
- each field has the same value (which describes a uniformly
+o each field has the same value (which describes a uniformly
typed record) *)
con mapU = K ==> fn f :: K => map (fn _ :: Unit => f)
@@ -290,3 +290,10 @@ val postFields : postBody -> list (string * string)
val max : t ::: Type -> ord t -> t -> t -> t
val min : t ::: Type -> ord t -> t -> t -> t
+
+val assert : t ::: Type
+ -> bool (* Did we avoid something bad? *)
+ -> string (* Explanation of the bad thing *)
+ -> string (* Source location of the bad thing *)
+ -> t (* Return this value if all went well. *)
+ -> t