aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/syntax/common/writer.lux
blob: 541f8849b37f8ee192aa24cc414c227032106c1c (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
31
32
33
(.module:
  {#.doc "Commons syntax writers."}
  [lux #*
   [control
    ["." function]]
   [data
    [collection
     ["." list ("#@." functor)]]
    ["." product]]
   [macro
    ["." code]]]
  ["." //])

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

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

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

(def: #export type-variables
  (-> (List Text) (List Code))
  (list@map code.local-identifier))