aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
blob: 214a266993f9895d4d1b77353292ed29a64cd1d7 (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
44
45
46
47
48
(.using
 [library
  [lux (.full)
   [abstract
    [equivalence (.only Equivalence)]]
   [control
    ["<>" parser (.only)
     ["<[0]>" binary (.only Parser)]]]
   [data
    ["[0]" product]
    ["[0]" text (.only)
     ["%" format (.only format)]]
    [format
     ["[0]" binary (.only Writer)]]]
   [math
    [number
     ["[0]" nat]]]
   [meta
    ["[0]" symbol]]]]
 [////
  ["[0]" version (.only Version)]])

(type: .public Signature
  (Record
   [#name Symbol
    #version Version]))

(def: .public equivalence
  (Equivalence Signature)
  (all product.equivalence
       symbol.equivalence
       nat.equivalence))

(def: .public (description signature)
  (-> Signature Text)
  (format (%.symbol (the #name signature)) " " (version.format (the #version signature))))

(def: .public writer
  (Writer Signature)
  (all binary.and
       (binary.and binary.text binary.text)
       binary.nat))

(def: .public parser
  (Parser Signature)
  (all <>.and
       (<>.and <binary>.text <binary>.text)
       <binary>.nat))