From 70005a6dee1eba3e3f5694aa4903e95988dcaa3d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 13 Nov 2017 23:26:06 -0400 Subject: - Refactoring. - Now giving type checking/inference a higher priority. - Better error messages. --- new-luxc/source/luxc/base.lux | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'new-luxc/source/luxc/base.lux') diff --git a/new-luxc/source/luxc/base.lux b/new-luxc/source/luxc/base.lux index c7768cd8c..373c6b12b 100644 --- a/new-luxc/source/luxc/base.lux +++ b/new-luxc/source/luxc/base.lux @@ -9,7 +9,8 @@ text/format (coll [list])) [meta] - (meta (type ["tc" check]))) + (meta (type ["tc" check]) + ["s" syntax #+ syntax:])) (luxc (lang ["la" analysis]))) (type: #export Eval @@ -30,16 +31,15 @@ (meta;fail (format message "\n\n" "@ " location)))) -(def: #export (assert message test) - (-> Text Bool (Meta Unit)) - (if test - (:: meta;Monad wrap []) - (fail message))) - (def: #export (throw exception message) (All [a] (-> ex;Exception Text (Meta a))) (fail (exception message))) +(syntax: #export (assert exception message test) + (wrap (list (` (if (~ test) + (:: meta;Monad (~' wrap) []) + (;;throw (~ exception) (~ message))))))) + (def: #export (with-expected-type expected action) (All [a] (-> Type (Meta a) (Meta a))) (function [compiler] -- cgit v1.2.3