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

## [Analysers]
(do-template [<name> <type> <tag>]
  [(def: #export (<name> value)
     (-> <type> (Meta Analysis))
     (do meta;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 meta;Monad<Meta>
    [_ (&;infer Unit)]
    (wrap (` []))))