aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/macro/syntax/input.lux
blob: b73caf2b79bdeb626421261adb7f8e8e3215f814 (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
34
35
36
37
38
39
40
41
42
43
(.module:
  [library
   [lux "*"
    [abstract
     [equivalence {"+" Equivalence}]]
    [control
     ["<>" parser
      ["<[0]>" code {"+" Parser}]]]
    [data
     ["[0]" product]
     [collection
      ["[0]" list ("[1]#[0]" monad)]]]
    [macro
     ["[0]" code]]]])

(type: .public Input
  (Record
   [#binding Code
    #type Code]))

(def: .public equivalence
  (Equivalence Input)
  ($_ product.equivalence
      code.equivalence
      code.equivalence
      ))

(def: .public format
  (-> (List Input) Code)
  (|>> (list#each (function (_ value)
                    (list (value@ #binding value)
                          (value@ #type value))))
       list#conjoint
       code.tuple))

(def: .public parser
  (Parser (List Input))
  (<| <code>.tuple
      <>.some
      ($_ <>.and
          <code>.any
          <code>.any
          )))