(.module: [lux (#- Name) [abstract [equivalence (#+ Equivalence)] [hash (#+ Hash)]] [data ["." product] ["." text ["%" format (#+ Format)]] [collection ["." list ("#\." monoid)]]] [world ["." file (#+ Path)] [net ["." uri (#+ URI)]]]]) (type: #export Group Text) (type: #export Name Text) (type: #export Version Text) (type: #export Artifact {#group Group #name Name #version Version}) (def: #export hash (Hash Artifact) ($_ product.hash text.hash text.hash text.hash )) (def: #export equivalence (Equivalence Artifact) (\ ..hash &equivalence)) (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 (directory separator group) (-> Text Group Text) (|> group (text.split_all_with ..group_separator) (text.join_with separator))) (def: (address separator artifact) (-> Text Artifact Text) (let [directory (%.format (..directory separator (get@ #group artifact)) separator (get@ #name artifact) separator (get@ #version artifact))] (%.format directory separator (..identity artifact)))) (def: #export uri (-> Artifact URI) (..address uri.separator)) (def: #export (path system) (All [!] (-> (file.System !) Artifact Path)) (..address (\ system separator))) (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))))