aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/macro/syntax/input.lux
blob: bdac8cad31f29c2cd610facf1b9444e9fb94efae (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
(.using
 [library
  [lux (.except)
   [abstract
    [equivalence (.only Equivalence)]]
   [control
    ["<>" parser (.only)
     ["<[0]>" code (.only Parser)]]]
   [data
    ["[0]" product]
    [collection
     ["[0]" list (.open: "[1]#[0]" monad)]]]
   [macro
    ["[0]" code]]]])

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

(def: .public equivalence
  (Equivalence Input)
  (all product.equivalence
       code.equivalence
       code.equivalence
       ))

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

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