aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/analyser')
-rw-r--r--new-luxc/source/luxc/analyser/case.lux2
-rw-r--r--new-luxc/source/luxc/analyser/function.lux18
-rw-r--r--new-luxc/source/luxc/analyser/inference.lux6
-rw-r--r--new-luxc/source/luxc/analyser/structure.lux8
4 files changed, 16 insertions, 18 deletions
diff --git a/new-luxc/source/luxc/analyser/case.lux b/new-luxc/source/luxc/analyser/case.lux
index 306618caf..7d580f3b4 100644
--- a/new-luxc/source/luxc/analyser/case.lux
+++ b/new-luxc/source/luxc/analyser/case.lux
@@ -55,7 +55,7 @@
(do Monad<Lux>
[[ex-id exT] (&;within-type-env
TC;existential)]
- (simplify-case-type (assume (type;apply-type type exT))))
+ (simplify-case-type (assume (type;apply (list exT) type))))
_
(:: Monad<Lux> wrap type)))
diff --git a/new-luxc/source/luxc/analyser/function.lux b/new-luxc/source/luxc/analyser/function.lux
index 5144534fb..f1d7fdd31 100644
--- a/new-luxc/source/luxc/analyser/function.lux
+++ b/new-luxc/source/luxc/analyser/function.lux
@@ -25,26 +25,24 @@
(#;Named name unnamedT)
(recur unnamedT)
- (#;App funT argT)
- (do @
- [fully-applied (case (type;apply-type funT argT)
- (#;Some value)
- (wrap value)
+ (#;Apply argT funT)
+ (case (type;apply (list argT) funT)
+ (#;Some value)
+ (recur value)
- #;None
- (&;fail (format "Cannot apply type " (%type funT) " to type " (%type argT))))]
- (recur fully-applied))
+ #;None
+ (&;fail (format "Cannot apply type " (%type funT) " to type " (%type argT))))
(#;UnivQ _)
(do @
[[var-id var] (&;within-type-env
TC;existential)]
- (recur (assume (type;apply-type expected var))))
+ (recur (assume (type;apply (list var) expected))))
(#;ExQ _)
(&common;with-var
(function [[var-id var]]
- (recur (assume (type;apply-type expected var)))))
+ (recur (assume (type;apply (list var) expected)))))
(#;Var id)
(do @
diff --git a/new-luxc/source/luxc/analyser/inference.lux b/new-luxc/source/luxc/analyser/inference.lux
index 11ec58eb3..8390a890c 100644
--- a/new-luxc/source/luxc/analyser/inference.lux
+++ b/new-luxc/source/luxc/analyser/inference.lux
@@ -31,7 +31,7 @@
([#;Sum]
[#;Product]
[#;Function]
- [#;App])
+ [#;Apply])
(#;Var id)
(if (n.= var-id id)
@@ -74,7 +74,7 @@
(&common;with-var
(function [[var-id varT]]
(do Monad<Lux>
- [[outputT argsA] (apply-function analyse (assume (type;apply-type funcT varT)) args)]
+ [[outputT argsA] (apply-function analyse (assume (type;apply (list varT) funcT)) args)]
(do @
[? (&;within-type-env
(TC;bound? var-id))
@@ -90,7 +90,7 @@
(do Monad<Lux>
[[ex-id exT] (&;within-type-env
TC;existential)]
- (apply-function analyse (assume (type;apply-type funcT exT)) args))
+ (apply-function analyse (assume (type;apply (list exT) funcT)) args))
## Arguments are inferred back-to-front because, by convention,
## Lux functions take the most important arguments *last*, which
diff --git a/new-luxc/source/luxc/analyser/structure.lux b/new-luxc/source/luxc/analyser/structure.lux
index 37266b2fe..267dfec84 100644
--- a/new-luxc/source/luxc/analyser/structure.lux
+++ b/new-luxc/source/luxc/analyser/structure.lux
@@ -68,13 +68,13 @@
(do @
[[var-id var] (&;within-type-env
TC;existential)]
- (&;with-expected-type (assume (type;apply-type expected var))
+ (&;with-expected-type (assume (type;apply (list var) expected))
(analyse-sum analyse tag valueC)))
(#;ExQ _)
(&common;with-var
(function [[var-id var]]
- (&;with-expected-type (assume (type;apply-type expected var))
+ (&;with-expected-type (assume (type;apply (list var) expected))
(analyse-sum analyse tag valueC))))
_
@@ -165,13 +165,13 @@
(do @
[[var-id var] (&;within-type-env
TC;existential)]
- (&;with-expected-type (assume (type;apply-type expected var))
+ (&;with-expected-type (assume (type;apply (list var) expected))
(analyse-product analyse membersC)))
(#;ExQ _)
(&common;with-var
(function [[var-id var]]
- (&;with-expected-type (assume (type;apply-type expected var))
+ (&;with-expected-type (assume (type;apply (list var) expected))
(analyse-product analyse membersC))))
_