aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser/structure.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/analyser/structure.lux64
1 files changed, 32 insertions, 32 deletions
diff --git a/new-luxc/source/luxc/analyser/structure.lux b/new-luxc/source/luxc/analyser/structure.lux
index a6424b466..3bcc04d7e 100644
--- a/new-luxc/source/luxc/analyser/structure.lux
+++ b/new-luxc/source/luxc/analyser/structure.lux
@@ -12,10 +12,10 @@
[dict #+ Dict])
[text]
text/format)
- [macro]
- (macro [code])
- [type]
- (type ["tc" check]))
+ [meta]
+ (meta [code]
+ [type]
+ (type ["tc" check])))
(luxc ["&" base]
(lang ["la" analysis])
["&;" module]
@@ -35,9 +35,9 @@
(format "Not a quantified type: " (%type type)))
(def: #export (analyse-sum analyse tag valueC)
- (-> &;Analyser Nat Code (Lux la;Analysis))
- (do macro;Monad<Lux>
- [expected macro;expected-type]
+ (-> &;Analyser Nat Code (Meta la;Analysis))
+ (do meta;Monad<Meta>
+ [expected meta;expected-type]
(&;with-stacked-errors
(function [_] (not-variant expected))
(case expected
@@ -100,9 +100,9 @@
(&;fail "")))))
(def: (analyse-typed-product analyse members)
- (-> &;Analyser (List Code) (Lux la;Analysis))
- (do macro;Monad<Lux>
- [expected macro;expected-type]
+ (-> &;Analyser (List Code) (Meta la;Analysis))
+ (do meta;Monad<Meta>
+ [expected meta;expected-type]
(loop [expected expected
members members]
(case [expected members]
@@ -140,7 +140,7 @@
## and what was analysed.
[tailT tailC]
(do @
- [g!tail (macro;gensym "tail")]
+ [g!tail (meta;gensym "tail")]
(&;with-expected-type tailT
(analyse (` ((~' _lux_case) [(~@ tailC)]
(~ g!tail)
@@ -148,9 +148,9 @@
))))
(def: #export (analyse-product analyse membersC)
- (-> &;Analyser (List Code) (Lux la;Analysis))
- (do macro;Monad<Lux>
- [expected macro;expected-type]
+ (-> &;Analyser (List Code) (Meta la;Analysis))
+ (do meta;Monad<Meta>
+ [expected meta;expected-type]
(&;with-stacked-errors
(function [_] (format "Invalid type for tuple: " (%type expected)))
(case expected
@@ -207,14 +207,14 @@
))))
(def: #export (analyse-tagged-sum analyse tag value)
- (-> &;Analyser Ident Code (Lux la;Analysis))
- (do macro;Monad<Lux>
- [tag (macro;normalize tag)
- [idx group variantT] (macro;resolve-tag tag)
+ (-> &;Analyser Ident Code (Meta la;Analysis))
+ (do meta;Monad<Meta>
+ [tag (meta;normalize tag)
+ [idx group variantT] (meta;resolve-tag tag)
#let [case-size (list;size group)]
inferenceT (&inference;variant-inference-type idx case-size variantT)
[inferredT valueA+] (&inference;apply-function analyse inferenceT (list value))
- expectedT macro;expected-type
+ expectedT meta;expected-type
_ (&;with-type-env
(tc;check expectedT inferredT))
temp &scope;next-local]
@@ -225,13 +225,13 @@
## Normalization just means that all the tags get resolved to their
## canonical form (with their corresponding module identified).
(def: #export (normalize record)
- (-> (List [Code Code]) (Lux (List [Ident Code])))
- (monad;map macro;Monad<Lux>
+ (-> (List [Code Code]) (Meta (List [Ident Code])))
+ (monad;map meta;Monad<Meta>
(function [[key val]]
(case key
[_ (#;Tag key)]
- (do macro;Monad<Lux>
- [key (macro;normalize key)]
+ (do meta;Monad<Meta>
+ [key (meta;normalize key)]
(wrap [key val]))
_
@@ -242,16 +242,16 @@
## re-implementing the same functionality for records makes no sense.
## Records, thus, get transformed into tuples by ordering the elements.
(def: #export (order record)
- (-> (List [Ident Code]) (Lux [(List Code) Type]))
+ (-> (List [Ident Code]) (Meta [(List Code) Type]))
(case record
## empty-record = empty-tuple = unit = []
#;Nil
- (:: macro;Monad<Lux> wrap [(list) Unit])
+ (:: meta;Monad<Meta> wrap [(list) Unit])
(#;Cons [head-k head-v] _)
- (do macro;Monad<Lux>
- [head-k (macro;normalize head-k)
- [_ tag-set recordT] (macro;resolve-tag head-k)
+ (do meta;Monad<Meta>
+ [head-k (meta;normalize head-k)
+ [_ tag-set recordT] (meta;resolve-tag head-k)
#let [size-record (list;size record)
size-ts (list;size tag-set)]
_ (if (n.= size-ts size-record)
@@ -265,7 +265,7 @@
idx->val (monad;fold @
(function [[key val] idx->val]
(do @
- [key (macro;normalize key)]
+ [key (meta;normalize key)]
(case (dict;get key tag->idx)
#;None
(&;fail (format "Tag " (%code (code;tag key))
@@ -284,11 +284,11 @@
))
(def: #export (analyse-record analyse members)
- (-> &;Analyser (List [Code Code]) (Lux la;Analysis))
- (do macro;Monad<Lux>
+ (-> &;Analyser (List [Code Code]) (Meta la;Analysis))
+ (do meta;Monad<Meta>
[members (normalize members)
[members recordT] (order members)
- expectedT macro;expected-type
+ expectedT meta;expected-type
inferenceT (&inference;record-inference-type recordT)
[inferredT membersA] (&inference;apply-function analyse inferenceT members)
_ (&;with-type-env