diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang.lux | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/new-luxc/source/luxc/lang.lux b/new-luxc/source/luxc/lang.lux index 5a00794f8..b4ed9638a 100644 --- a/new-luxc/source/luxc/lang.lux +++ b/new-luxc/source/luxc/lang.lux @@ -32,8 +32,8 @@ "@ " location)))) (def: #export (throw exception message) - (All [a] (-> ex.Exception Text (Meta a))) - (fail (exception message))) + (All [e a] (-> (ex.Exception e) e (Meta a))) + (fail (ex.construct exception message))) (syntax: #export (assert exception message test) (wrap (list (` (if (~ test) @@ -42,7 +42,7 @@ (def: #export (with-type expected action) (All [a] (-> Type (Meta a) (Meta a))) - (function [compiler] + (function (_ compiler) (case (action (set@ #.expected (#.Some expected) compiler)) (#e.Success [compiler' output]) (let [old-expected (get@ #.expected compiler)] @@ -54,7 +54,7 @@ (def: #export (with-type-env action) (All [a] (-> (tc.Check a) (Meta a))) - (function [compiler] + (function (_ compiler) (case (action (get@ #.type-context compiler)) (#e.Error error) ((fail error) compiler) @@ -65,7 +65,7 @@ (def: #export (with-fresh-type-env action) (All [a] (-> (Meta a) (Meta a))) - (function [compiler] + (function (_ compiler) (let [old (get@ #.type-context compiler)] (case (action (set@ #.type-context tc.fresh-context compiler)) (#e.Success [compiler' output]) @@ -128,7 +128,7 @@ (def: #export (with-source-code source action) (All [a] (-> Source (Meta a) (Meta a))) - (function [compiler] + (function (_ compiler) (let [old-source (get@ #.source compiler)] (case (action (set@ #.source source compiler)) (#e.Error error) @@ -140,7 +140,7 @@ (def: #export (with-stacked-errors handler action) (All [a] (-> (-> [] Text) (Meta a) (Meta a))) - (function [compiler] + (function (_ compiler) (case (action compiler) (#e.Success [compiler' output]) (#e.Success [compiler' output]) @@ -164,7 +164,7 @@ (def: #export (with-scope action) (All [a] (-> (Meta a) (Meta [Scope a]))) - (function [compiler] + (function (_ compiler) (case (action (update@ #.scopes (|>> (#.Cons fresh-scope)) compiler)) (#e.Success [compiler' output]) (case (get@ #.scopes compiler') @@ -180,7 +180,7 @@ (def: #export (with-current-module name action) (All [a] (-> Text (Meta a) (Meta a))) - (function [compiler] + (function (_ compiler) (case (action (set@ #.current-module (#.Some name) compiler)) (#e.Success [compiler' output]) (#e.Success [(set@ #.current-module @@ -195,7 +195,7 @@ (All [a] (-> Cursor (Meta a) (Meta a))) (if (text/= "" (product.left cursor)) action - (function [compiler] + (function (_ compiler) (let [old-cursor (get@ #.cursor compiler)] (case (action (set@ #.cursor cursor compiler)) (#e.Success [compiler' output]) @@ -244,11 +244,12 @@ output (recur (n/dec idx) (format (|> (text.nth idx name) maybe.assume normalize-char) output))))) -(exception: #export Error) +(exception: #export (Error {message Text}) + message) (def: #export (with-error-tracking action) (All [a] (-> (Meta a) (Meta a))) - (function [compiler] + (function (_ compiler) (case (action compiler) (#e.Error error) ((throw Error error) compiler) |