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

(def: #export (export exported?)
  (-> Bit (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))