aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/syntax/common/check.lux
blob: 081e394b0e580d2a289e93543b3d3f4255014faf (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
(.module:
  [lux #*
   ["." meta]
   [abstract
    [equivalence (#+ Equivalence)]
    [monad (#+ do)]]
   [control
    ["." exception (#+ exception:)]
    ["<>" parser
     ["<.>" code (#+ Parser)]]]
   [data
    ["." product]]
   [macro
    ["." code]]])

(def: extension
  "lux check")

(type: #export Check
  {#type Code
   #value Code})

(def: #export equivalence
  (Equivalence Check)
  ($_ product.equivalence
      code.equivalence
      code.equivalence
      ))

(def: #export (write (^slots [#type #value]))
  (-> Check Code)
  (` ((~ (code.text ..extension))
      (~ type)
      (~ value))))

(def: #export parser
  (Parser Check)
  (<| <code>.form
      (<>.after (<code>.text! ..extension))
      (<>.and <code>.any
              <code>.any)))