summaryrefslogtreecommitdiff
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
commite409acfa13f877ddae461cc2d711807ae74cd168 (patch)
tree5936c8f8cc5844b805e0a7d6ce2a86eb6e409db9
parentf97ff31913211b5cd34278782285e920788583f9 (diff)
assert function to use with location literal _LOC_
-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>