# HG changeset patch # User Adam Chlipala # Date 1433339737 14400 # Node ID 2d9e40e726f243decdc99e88207a8c4d292591a6 # Parent 4cd36865e0b59cbbfa9bfd30144e121a39af4df2 Adjust new [assert] to work properly from top.ur diff -r 4cd36865e0b5 -r 2d9e40e726f2 lib/ur/top.ur --- a/lib/ur/top.ur Wed Jun 03 15:07:46 2015 +0200 +++ b/lib/ur/top.ur Wed Jun 03 09:55:37 2015 -0400 @@ -412,4 +412,4 @@ 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 {[msg]} at {[loc]} + if cond then x else error {txt msg} at {txt loc} diff -r 4cd36865e0b5 -r 2d9e40e726f2 lib/ur/top.urs --- a/lib/ur/top.urs Wed Jun 03 15:07:46 2015 +0200 +++ b/lib/ur/top.urs Wed Jun 03 09:55:37 2015 -0400 @@ -35,7 +35,7 @@ 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 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