(.module: [library [lux (#- Name) [abstract [equivalence (#+ Equivalence)] [order (#+ Order)] [hash (#+ Hash)]] [data ["." product] ["." text ("#\." order) ["%" format (#+ Format)]] [collection ["." list ("#\." monoid)]]] [world ["." file (#+ Path)] [net ["." uri (#+ URI)]]]]]) (type: .public Group Text) (type: .public Name Text) (type: .public Version Text) (type: .public Artifact {#group Group #name Name #version Version}) (def: .public hash (Hash Artifact) ($_ product.hash text.hash text.hash text.hash )) (def: .public equivalence (Equivalence Artifact) (\ ..hash &equivalence)) (implementation: .public order (Order Artifact) (def: &equivalence ..equivalence) (def: (< reference subject) (<| (or (text\< (get@ #group reference) (get@ #group subject))) (and (text\= (get@ #group reference) (get@ #group subject))) (or (text\< (get@ #name reference) (get@ #name subject))) (and (text\= (get@ #name reference) (get@ #name subject))) (text\< (get@ #version reference) (get@ #version subject))))) (template [ ] [(def: Text )] ["." group_separator] ["-" version_separator] [":" identity_separator] ) (def: .public (identity artifact) (-> Artifact Text) (%.format (get@ #name artifact) ..version_separator (get@ #version artifact))) (def: .public (format value) (Format Artifact) (%.format (get@ #group value) ..identity_separator (..identity value))) (def: .public (directory separator group) (-> Text Group Text) (|> group (text.all_split_by ..group_separator) (text.interposed separator))) (def: .public (uri version artifact) (-> Version Artifact URI) (let [/ uri.separator group (..directory / (get@ #group artifact)) name (get@ #name artifact) ... version (get@ #version artifact) identity (..identity artifact)] (%.format group / name / version / identity))) (def: .public (local artifact) (-> Artifact (List Text)) (list\compose (|> artifact (get@ #group) (text.all_split_by ..group_separator)) (list (get@ #name artifact) (get@ #version artifact))))