blob: 26580a50381442a44ba58d69538ce4931e4016e1 (
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
28
29
30
31
32
33
34
|
(;module:
lux
(lux (control monad)
[macro #+ Monad<Lux>]
(type ["TC" check]))
(luxc ["&" base]
(lang ["la" analysis #+ Analysis])))
## [Analysers]
(do-template [<name> <type> <tag>]
[(def: #export (<name> value)
(-> <type> (Lux Analysis))
(do Monad<Lux>
[expected macro;expected-type
_ (&;within-type-env
(TC;check expected <type>))]
(wrap (<tag> value))))]
[analyse-bool Bool #la;Bool]
[analyse-nat Nat #la;Nat]
[analyse-int Int #la;Int]
[analyse-deg Deg #la;Deg]
[analyse-real Real #la;Real]
[analyse-char Char #la;Char]
[analyse-text Text #la;Text]
)
(def: #export analyse-unit
(Lux Analysis)
(do Monad<Lux>
[expected macro;expected-type
_ (&;within-type-env
(TC;check expected Unit))]
(wrap #la;Unit)))
|