aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/dependency.lux
blob: 451accd25b662e6f53ee1ca108fb4b8786dd4e19 (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
(.module:
  [library
   [lux {"-" [Type]}
    [abstract
     [equivalence {"+" [Equivalence]}]
     [order {"+" [Order]}]
     [hash {"+" [Hash]}]]
    [data
     ["[0]" product]
     ["[0]" text ("[1]#[0]" order)
      ["%" format {"+" [format]}]]]]]
  ["[0]" // "_"
   ["[1]" artifact {"+" [Artifact]} ("[1]#[0]" order)
    [type {"+" [Type]}]]])

(type: .public Dependency
  (Record
   [#artifact Artifact
    #type Type]))

(def: .public hash
  (Hash Dependency)
  ($_ product.hash
      //.hash
      text.hash
      ))

(def: .public equivalence
  (Equivalence Dependency)
  (# hash &equivalence))

(implementation: .public order
  (Order Dependency)

  (def: &equivalence
    ..equivalence)

  (def: (< reference subject)
    (<| (or (//#< (value@ #artifact reference)
                  (value@ #artifact subject)))
        
        (and (//#= (value@ #artifact reference)
                   (value@ #artifact subject)))
        (text#< (value@ #type reference)
                (value@ #type subject)))))