diff options
author | Eduardo Julian | 2017-10-31 23:39:49 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-31 23:39:49 -0400 |
commit | 15121222d570f8fe3c5a326208e4f0bad737e63c (patch) | |
tree | 88c93ed1f4965fd0e80677df5553a0d47e521963 /new-luxc/source/luxc/lang/analysis/type.lux | |
parent | a269ea72337852e8e57bd427773baed111ad6e92 (diff) |
- Re-organized analysis.
Diffstat (limited to 'new-luxc/source/luxc/lang/analysis/type.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/analysis/type.lux | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/analysis/type.lux b/new-luxc/source/luxc/lang/analysis/type.lux new file mode 100644 index 000000000..d0b038d93 --- /dev/null +++ b/new-luxc/source/luxc/lang/analysis/type.lux @@ -0,0 +1,31 @@ +(;module: + lux + (lux (control monad) + [meta #+ Monad<Meta>] + (meta (type ["TC" check]))) + (luxc ["&" base] + (lang ["la" analysis #+ Analysis]))) + +## These 2 analysers are somewhat special, since they require the +## means of evaluating Lux expressions at compile-time for the sake of +## computing Lux type values. +(def: #export (analyse-check analyse eval type value) + (-> &;Analyser &;Eval Code Code (Meta Analysis)) + (do Monad<Meta> + [actual (eval Type type) + #let [actual (:! Type actual)] + expected meta;expected-type + _ (&;with-type-env + (TC;check expected actual))] + (&;with-expected-type actual + (analyse value)))) + +(def: #export (analyse-coerce analyse eval type value) + (-> &;Analyser &;Eval Code Code (Meta Analysis)) + (do Monad<Meta> + [actual (eval Type type) + expected meta;expected-type + _ (&;with-type-env + (TC;check expected (:! Type actual)))] + (&;with-expected-type Top + (analyse value)))) |