aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser/inference.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/analyser/inference.lux')
-rw-r--r--new-luxc/source/luxc/analyser/inference.lux21
1 files changed, 11 insertions, 10 deletions
diff --git a/new-luxc/source/luxc/analyser/inference.lux b/new-luxc/source/luxc/analyser/inference.lux
index 8390a890c..9b2411249 100644
--- a/new-luxc/source/luxc/analyser/inference.lux
+++ b/new-luxc/source/luxc/analyser/inference.lux
@@ -1,11 +1,12 @@
(;module:
lux
(lux (control monad)
- (data text/format
+ (data [maybe]
+ text/format
(coll [list "L/" Functor<List>]))
[macro #+ Monad<Lux>]
[type]
- (type ["TC" check]))
+ (type ["tc" check]))
(luxc ["&" base]
(lang ["la" analysis #+ Analysis])
(analyser ["&;" common])))
@@ -74,23 +75,23 @@
(&common;with-var
(function [[var-id varT]]
(do Monad<Lux>
- [[outputT argsA] (apply-function analyse (assume (type;apply (list varT) funcT)) args)]
+ [[outputT argsA] (apply-function analyse (maybe;assume (type;apply (list varT) funcT)) args)]
(do @
- [? (&;within-type-env
- (TC;bound? var-id))
+ [? (&;with-type-env
+ (tc;bound? var-id))
## Quantify over the type if genericity/parametricity
## is discovered.
outputT' (if ?
- (&;within-type-env
- (TC;clean var-id outputT))
+ (&;with-type-env
+ (tc;clean var-id outputT))
(wrap (type;univ-q +1 (replace-var var-id +1 outputT))))]
(wrap [outputT' argsA])))))
(#;ExQ _)
(do Monad<Lux>
- [[ex-id exT] (&;within-type-env
- TC;existential)]
- (apply-function analyse (assume (type;apply (list exT) funcT)) args))
+ [[ex-id exT] (&;with-type-env
+ tc;existential)]
+ (apply-function analyse (maybe;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