diff options
author | Eduardo Julian | 2017-05-15 22:19:14 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-15 22:19:14 -0400 |
commit | 824482b2e8b13e42a524a5e4945ea3e172395c9e (patch) | |
tree | 959bb7684461318b1026cd773ae29ac76d426054 /new-luxc/source/luxc/analyser/type.lux | |
parent | 04c0a8d2fceae628099673e62527fc48e2afd7e7 (diff) |
WIP
- Simplified the Analysis type, by removing all meta-data.
- Added analysis of function calls.
- Added analysis of common Lux procedures.
- Lots of refactoring.
Diffstat (limited to 'new-luxc/source/luxc/analyser/type.lux')
-rw-r--r-- | new-luxc/source/luxc/analyser/type.lux | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/analyser/type.lux b/new-luxc/source/luxc/analyser/type.lux new file mode 100644 index 000000000..3b9b83245 --- /dev/null +++ b/new-luxc/source/luxc/analyser/type.lux @@ -0,0 +1,29 @@ +(;module: + lux + (lux (control monad) + [macro #+ Monad<Lux>] + (type ["TC" check])) + (luxc ["&" base] + (lang ["la" analysis #+ Analysis]))) + +## [Analysers] +(def: #export (analyse-check analyse eval type value) + (-> &;Analyser &;Eval Code Code (Lux Analysis)) + (do Monad<Lux> + [actual (eval Type type) + #let [actual (:! Type actual)] + expected macro;expected-type + _ (&;within-type-env + (TC;check expected actual))] + (&;with-expected-type actual + (analyse value)))) + +(def: #export (analyse-coerce analyse eval type value) + (-> &;Analyser &;Eval Code Code (Lux Analysis)) + (do Monad<Lux> + [actual (eval Type type) + expected macro;expected-type + _ (&;within-type-env + (TC;check expected (:! Type actual)))] + (&;with-expected-type Top + (analyse value)))) |