aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/syntax/common/writer.lux
blob: d482bc2c3c16b69d06930d569560ba9cc1ad8656 (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:
  {#.doc "Commons syntax writers."}
  [lux #*
   [data
    [collection [list ("list/" Functor<List>)]]
    [product]]
   [macro [code]]]
  [//])

(def: #export (export exported?)
  (-> Bool (List Code))
  (if exported?
    (list (' #export))
    (list)))

(def: #export (declaration declaration)
  (-> //.Declaration Code)
  (` ((~ (code.local-symbol (get@ #//.declaration-name declaration)))
      (~+ (list/map code.local-symbol
                    (get@ #//.declaration-args declaration))))))

(def: #export (annotations anns)
  (-> //.Annotations Code)
  (|> anns (list/map (product.both code.tag id)) code.record))

(def: #export (type-variables vars)
  (-> (List Text) (List Code))
  (list/map code.local-symbol vars))