aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser/inference.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/analyser/inference.lux34
1 files changed, 17 insertions, 17 deletions
diff --git a/new-luxc/source/luxc/analyser/inference.lux b/new-luxc/source/luxc/analyser/inference.lux
index 9b2411249..edb90e73d 100644
--- a/new-luxc/source/luxc/analyser/inference.lux
+++ b/new-luxc/source/luxc/analyser/inference.lux
@@ -4,9 +4,9 @@
(data [maybe]
text/format
(coll [list "L/" Functor<List>]))
- [macro #+ Monad<Lux>]
- [type]
- (type ["tc" check]))
+ [meta #+ Monad<Meta>]
+ (meta [type]
+ (type ["tc" check])))
(luxc ["&" base]
(lang ["la" analysis #+ Analysis])
(analyser ["&;" common])))
@@ -61,10 +61,10 @@
## But, so long as the type being used for the inference can be trated
## as a function type, this method of inference should work.
(def: #export (apply-function analyse funcT args)
- (-> &;Analyser Type (List Code) (Lux [Type (List Analysis)]))
+ (-> &;Analyser Type (List Code) (Meta [Type (List Analysis)]))
(case args
#;Nil
- (:: Monad<Lux> wrap [funcT (list)])
+ (:: Monad<Meta> wrap [funcT (list)])
(#;Cons arg args')
(case funcT
@@ -74,7 +74,7 @@
(#;UnivQ _)
(&common;with-var
(function [[var-id varT]]
- (do Monad<Lux>
+ (do Monad<Meta>
[[outputT argsA] (apply-function analyse (maybe;assume (type;apply (list varT) funcT)) args)]
(do @
[? (&;with-type-env
@@ -88,7 +88,7 @@
(wrap [outputT' argsA])))))
(#;ExQ _)
- (do Monad<Lux>
+ (do Monad<Meta>
[[ex-id exT] (&;with-type-env
tc;existential)]
(apply-function analyse (maybe;assume (type;apply (list exT) funcT)) args))
@@ -101,7 +101,7 @@
## avoided in Lux code, since the inference algorithm can piece
## things together more easily.
(#;Function inputT outputT)
- (do Monad<Lux>
+ (do Monad<Meta>
[[outputT' args'A] (apply-function analyse outputT args')
argA (&;with-stacked-errors
(function [_] (format "Expected type: " (%type inputT) "\n"
@@ -116,39 +116,39 @@
## Turns a record type into the kind of function type suitable for inference.
(def: #export (record-inference-type type)
- (-> Type (Lux Type))
+ (-> Type (Meta Type))
(case type
(#;Named name unnamedT)
- (do Monad<Lux>
+ (do Monad<Meta>
[unnamedT+ (record-inference-type unnamedT)]
(wrap (#;Named name unnamedT+)))
(^template [<tag>]
(<tag> env bodyT)
- (do Monad<Lux>
+ (do Monad<Meta>
[bodyT+ (record-inference-type bodyT)]
(wrap (<tag> env bodyT+))))
([#;UnivQ]
[#;ExQ])
(#;Product _)
- (:: Monad<Lux> wrap (type;function (type;flatten-tuple type) type))
+ (:: Monad<Meta> wrap (type;function (type;flatten-tuple type) type))
_
(&;fail (format "Not a record type: " (%type type)))))
## Turns a variant type into the kind of function type suitable for inference.
(def: #export (variant-inference-type tag expected-size type)
- (-> Nat Nat Type (Lux Type))
+ (-> Nat Nat Type (Meta Type))
(case type
(#;Named name unnamedT)
- (do Monad<Lux>
+ (do Monad<Meta>
[unnamedT+ (variant-inference-type tag expected-size unnamedT)]
(wrap (#;Named name unnamedT+)))
(^template [<tag>]
(<tag> env bodyT)
- (do Monad<Lux>
+ (do Monad<Meta>
[bodyT+ (variant-inference-type tag expected-size bodyT)]
(wrap (<tag> env bodyT+))))
([#;UnivQ]
@@ -163,7 +163,7 @@
(n.< boundary tag)))
(case (list;nth tag cases)
(#;Some caseT)
- (:: Monad<Lux> wrap (type;function (list caseT) type))
+ (:: Monad<Meta> wrap (type;function (list caseT) type))
#;None
(&common;variant-out-of-bounds-error type expected-size tag))
@@ -175,7 +175,7 @@
(n.= boundary tag)
(let [caseT (type;variant (list;drop boundary cases))]
- (:: Monad<Lux> wrap (type;function (list caseT) type)))
+ (:: Monad<Meta> wrap (type;function (list caseT) type)))
## else
(&common;variant-out-of-bounds-error type expected-size tag)))