aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/analysis')
-rw-r--r--new-luxc/source/luxc/lang/analysis/procedure.lux9
-rw-r--r--new-luxc/source/luxc/lang/analysis/procedure/common.lux12
2 files changed, 12 insertions, 9 deletions
diff --git a/new-luxc/source/luxc/lang/analysis/procedure.lux b/new-luxc/source/luxc/lang/analysis/procedure.lux
index 225fb7b23..9f5f61d59 100644
--- a/new-luxc/source/luxc/lang/analysis/procedure.lux
+++ b/new-luxc/source/luxc/lang/analysis/procedure.lux
@@ -1,6 +1,7 @@
(;module:
lux
- (lux (control [monad #+ do])
+ (lux (control [monad #+ do]
+ ["ex" exception #+ exception:])
(data [maybe]
[text]
text/format
@@ -10,6 +11,8 @@
(. ["./;" common]
["./;" host]))
+(exception: #export Unknown-Procedure)
+
(def: procedures
./common;Bundle
(|> ./common;procedures
@@ -17,7 +20,7 @@
(def: #export (analyse-procedure analyse eval proc-name proc-args)
(-> &;Analyser &;Eval Text (List Code) (Meta la;Analysis))
- (<| (maybe;default (&;fail (format "Unknown procedure: " (%t proc-name))))
+ (<| (maybe;default (&;throw Unknown-Procedure proc-name))
(do maybe;Monad<Maybe>
[proc (dict;get proc-name procedures)]
- (wrap (proc analyse eval proc-args)))))
+ (wrap ((proc proc-name) analyse eval proc-args)))))
diff --git a/new-luxc/source/luxc/lang/analysis/procedure/common.lux b/new-luxc/source/luxc/lang/analysis/procedure/common.lux
index e06a3d2b4..f3c296b2b 100644
--- a/new-luxc/source/luxc/lang/analysis/procedure/common.lux
+++ b/new-luxc/source/luxc/lang/analysis/procedure/common.lux
@@ -1,7 +1,7 @@
(;module:
lux
(lux (control [monad #+ do])
- (concurrency ["A" atom])
+ (concurrency [atom #+ Atom])
(data [text]
text/format
(coll [list "list/" Functor<List>]
@@ -23,12 +23,12 @@
(-> &;Analyser &;Eval (List Code) (Meta la;Analysis)))
(type: #export Bundle
- (Dict Text Proc))
+ (Dict Text (-> Text Proc)))
(def: #export (install name unnamed)
(-> Text (-> Text Proc)
(-> Bundle Bundle))
- (dict;put name (unnamed name)))
+ (dict;put name unnamed))
(def: #export (prefix prefix bundle)
(-> Text Bundle Bundle)
@@ -357,7 +357,7 @@
[initA (&;with-expected-type varT
(analyse initC))
outputT (&;with-type-env
- (tc;clean var-id (type (A;Atom varT))))
+ (tc;clean var-id (type (Atom varT))))
expected meta;expected-type
_ (&;with-type-env
(tc;check expected outputT))]
@@ -371,7 +371,7 @@
(function [analyse eval args]
(&common;with-var
(function [[var-id varT]]
- ((unary (type (A;Atom varT)) varT proc)
+ ((unary (type (Atom varT)) varT proc)
analyse eval args)))))
(def: (atom-compare-and-swap proc)
@@ -379,7 +379,7 @@
(function [analyse eval args]
(&common;with-var
(function [[var-id varT]]
- ((trinary varT varT (type (A;Atom varT)) Bool proc)
+ ((trinary varT varT (type (Atom varT)) Bool proc)
analyse eval args)))))
(def: atom-procs