aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/analysis/primitive.lux
blob: 8270e7e733f24cedc3e33e1374599ae73e2bd5de (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
(.module:
  lux
  (lux (control monad)
       [macro]
       (macro [code])
       (lang (type ["tc" check])))
  (luxc ["&" lang]
        (lang ["la" analysis #+ Analysis])))

## [Analysers]
(do-template [<name> <type> <tag>]
  [(def: #export (<name> value)
     (-> <type> (Meta Analysis))
     (do macro.Monad<Meta>
       [_ (&.infer <type>)]
       (wrap (<tag> value))))]

  [analyse-bool Bool code.bool]
  [analyse-nat  Nat  code.nat]
  [analyse-int  Int  code.int]
  [analyse-deg  Deg  code.deg]
  [analyse-frac Frac code.frac]
  [analyse-text Text code.text]
  )

(def: #export analyse-unit
  (Meta Analysis)
  (do macro.Monad<Meta>
    [_ (&.infer Unit)]
    (wrap (` []))))