aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux
blob: 8dae11fe4c92ac656ebeaff5fe187f2607a83f2d (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
      ["<b>" binary (#+ Parser)]]]
    [data
     ["." product]
     ["." name]
     ["." text
      ["%" format (#+ format)]]
     [format
      ["." binary (#+ Writer)]]]
    [math
     [number
      ["." nat]]]]]
  [////
   [version (#+ Version)]])

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

(def: .public equivalence
  (Equivalence Signature)
  (product.equivalence name.equivalence nat.equivalence))

(def: .public (description signature)
  (-> Signature Text)
  (format (%.name (value@ #name signature)) " " (%.nat (value@ #version signature))))

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

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