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

(type: #export Dependency
  {#artifact Artifact
   #type Type})

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

(def: #export equivalence
  (Equivalence Dependency)
  (\ hash &equivalence))

(implementation: #export order
  (Order Dependency)

  (def: &equivalence
    ..equivalence)

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