aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/artifact/value.lux
blob: 3e92dbf168527b966d28a79f84e223bdd3d72067 (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
(.module:
  [lux #*
   [abstract
    [equivalence (#+ Equivalence)]]
   [data
    ["." product]
    ["." text
     ["%" format]]
    [collection
     ["." list ("#\." functor)]]]
   [math
    [number
     ["." nat]]]
   [time
    ["." instant]]]
  [// (#+ Version)
   ["." time_stamp (#+ Time_Stamp)]])

(type: #export Build
  Nat)

(type: #export Value
  {#version Version
   #time_stamp Time_Stamp
   #build Build})

(def: #export equivalence
  (Equivalence Value)
  ($_ product.equivalence
      text.equivalence
      instant.equivalence
      nat.equivalence
      ))

(def: separator
  "-")

(def: snapshot
  "SNAPSHOT")

(def: #export (format (^slots [#version #time_stamp #build]))
  (%.Format Value)
  (%.format (text.replace_all ..snapshot
                              (time_stamp.format time_stamp)
                              version)
            ..separator
            (%.nat build)))