aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar Gabriel Riba Faura <griba2001@gmail.com>2015-06-03 15:07:46 +0200
committerGravatar Gabriel Riba Faura <griba2001@gmail.com>2015-06-03 15:07:46 +0200
commit667321ef5eb38e7cfbf5ce52010e9c95dc5f6874 (patch)
tree5936c8f8cc5844b805e0a7d6ce2a86eb6e409db9 /lib/ur
parentde90e13f1cd152318791f47d75280f03e768c7cc (diff)
assert function to use with location literal _LOC_
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/top.ur3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 3250a5a3..06dcab5f 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -410,3 +410,6 @@ fun max [t] ( _ : ord t) (x : t) (y : t) : t =
if x > y then x else y
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>