changeset 2151:4cd36865e0b5

assert function to use with location literal _LOC_
author Gabriel Riba Faura <griba2001@gmail.com>
date Wed, 03 Jun 2015 15:07:46 +0200
parents 763ccca119bc
children 2d9e40e726f2
files lib/ur/top.ur
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/top.ur	Wed Jun 03 08:34:23 2015 +0200
+++ b/lib/ur/top.ur	Wed Jun 03 15:07:46 2015 +0200
@@ -410,3 +410,6 @@
     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>