aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/analyser.lux32
1 files changed, 16 insertions, 16 deletions
diff --git a/new-luxc/source/luxc/analyser.lux b/new-luxc/source/luxc/analyser.lux
index 3272057f2..f17ec8496 100644
--- a/new-luxc/source/luxc/analyser.lux
+++ b/new-luxc/source/luxc/analyser.lux
@@ -76,16 +76,12 @@
body)))
(&&function;analyse-function analyse func-name arg-name body)
- (^ (#;Form (list [_ (#;Symbol ["" "_lux_check"])]
- type
- value)))
- (&&type;analyse-check analyse eval type value)
-
- (^ (#;Form (list [_ (#;Symbol ["" "_lux_coerce"])]
- type
- value)))
- (&&type;analyse-coerce analyse eval type value)
-
+ (^template [<proc> <analyser>]
+ (^ (#;Form (list [_ (#;Symbol ["" <proc>])] type value)))
+ (<analyser> analyse eval type value))
+ (["_lux_check" &&type;analyse-check]
+ ["_lux_coerce" &&type;analyse-coerce])
+
(^ (#;Form (list& [_ (#;Text proc-name)] proc-args)))
(&&procedure;analyse-procedure analyse proc-name proc-args)
@@ -96,13 +92,17 @@
[paired (to-branches branches)]
(&&case;analyse-case analyse input paired))
- (^ (#;Form (list [_ (#;Nat tag)]
- value)))
- (&&structure;analyse-sum analyse tag value)
+ (^template [<tag> <analyser>]
+ (^ (#;Form (list& [_ (<tag> tag)]
+ values)))
+ (case values
+ (#;Cons value #;Nil)
+ (<analyser> analyse tag value)
- (^ (#;Form (list [_ (#;Tag tag)]
- value)))
- (&&structure;analyse-tagged-sum analyse tag value)
+ _
+ (<analyser> analyse tag (` [(~@ values)]))))
+ ([#;Nat &&structure;analyse-sum]
+ [#;Tag &&structure;analyse-tagged-sum])
(^ (#;Form (list& func args)))
(do Monad<Lux>