aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/lang/analysis/primitive.lux
blob: 74596fba2a01eb9dba5d48c2d2131c5c8beb7942 (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
(.module:
  [lux #- nat int deg]
  (lux (control monad)
       [macro])
  [// #+ Analysis]
  (// [".A" type]))

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

  [bool Bool #//.Bool]
  [nat  Nat  #//.Nat]
  [int  Int  #//.Int]
  [deg  Deg  #//.Deg]
  [frac Frac #//.Frac]
  [text Text #//.Text]
  )

(def: #export unit
  (Meta Analysis)
  (do macro.Monad<Meta>
    [_ (typeA.infer Any)]
    (wrap (#//.Primitive #//.Unit))))