From 667321ef5eb38e7cfbf5ce52010e9c95dc5f6874 Mon Sep 17 00:00:00 2001 From: Gabriel Riba Faura Date: Wed, 3 Jun 2015 15:07:46 +0200 Subject: assert function to use with location literal _LOC_ --- lib/ur/top.ur | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/ur/top.ur') 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 {[msg]} at {[loc]} -- cgit v1.2.3