(.module: [lux (#- Name) [abstract ["." equivalence (#+ Equivalence)] ["." hash (#+ Hash)]] [data ["." text ["%" format (#+ Format)]] [collection ["." list ("#@." monoid)]]] [world [net ["." uri]]]]) (type: #export Group Text) (type: #export Name Text) (type: #export Version Text) (type: #export Artifact {#group Group #name Name #version Version}) (def: #export equivalence (Equivalence Artifact) ($_ equivalence.product text.equivalence text.equivalence text.equivalence )) (def: #export hash (Hash Artifact) ($_ hash.product text.hash text.hash text.hash )) (template [ ] [(def: Text )] ["." group-separator] ["-" version-separator] [":" identity-separator] ) (def: #export (identity artifact) (-> Artifact Text) (%.format (get@ #name artifact) ..version-separator (get@ #version artifact))) (def: #export (format value) (Format Artifact) (%.format (get@ #group value) ..identity-separator (..identity value))) (def: #export (path artifact) (-> Artifact Text) (let [directory (%.format (|> artifact (get@ #group) (text.split-all-with ..group-separator) (text.join-with uri.separator)) uri.separator (get@ #name artifact) uri.separator (get@ #version artifact))] (%.format directory uri.separator (..identity artifact)))) (def: #export (local artifact) (-> Artifact (List Text)) (list@compose (|> artifact (get@ #group) (text.split-all-with ..group-separator)) (list (get@ #name artifact) (get@ #version artifact))))