blob: 4184dd0c03833501782355f6b53b296343af8be3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
(;module:
lux
(lux (control monad)
[meta]
(meta (type ["tc" check])))
(luxc ["&" lang]
(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 meta;Monad<Meta>
[actualT (eval Type type)
#let [actualT (:! Type actualT)]
_ (&;infer actualT)]
(&;with-expected-type actualT
(analyse value))))
(def: #export (analyse-coerce analyse eval type value)
(-> &;Analyser &;Eval Code Code (Meta Analysis))
(do meta;Monad<Meta>
[actualT (eval Type type)
_ (&;infer (:! Type actualT))]
(&;with-expected-type Top
(analyse value))))
|