(.module: [library [lux {"-" [local]} [abstract [equivalence {"+" [Equivalence]}]] [control ["." try {"+" [Try]} ("#\." functor)] [parser ["<.>" xml]]] [data ["." sum] ["." product] ["." binary {"+" [Binary]}] [text [encoding ["." utf8]]] [format ["." xml {"+" [XML]}]] [collection [set {"+" [Set]}]]]]] ["." // "_" ["/" profile] ["#." hash] ["#." pom] [dependency {"+" [Dependency]} ["#." status {"+" [Status]}]] [repository [remote {"+" [Address]}] ["#." origin {"+" [Origin]}]]]) (type: .public Package (Record [#origin Origin #library [Binary Status] #pom [XML Binary Status]])) (template [ ] [(def: .public ( package) (-> Package Bit) (case (value@ #origin package) ( _) true _ false))] [local? #//origin.Local] [remote? #//origin.Remote] ) (def: .public (local pom library) (-> XML Binary Package) [#origin (#//origin.Local "") #library [library (#//status.Verified (//hash.sha-1 library) (//hash.md5 library))] #pom (let [binary_pom (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] [pom binary_pom (#//status.Verified (//hash.sha-1 binary_pom) (//hash.md5 binary_pom))])]) (def: .public dependencies (-> Package (Try (Set Dependency))) (|>> (value@ #pom) product.left list (.result //pom.parser) (try\each (value@ #/.dependencies)))) (def: .public repositories (-> Package (Try (Set Address))) (|>> (value@ #pom) product.left list (.result //pom.parser) (try\each (value@ #/.repositories)))) (def: .public equivalence (Equivalence Package) ($_ product.equivalence //origin.equivalence ($_ product.equivalence binary.equivalence //status.equivalence) ($_ product.equivalence xml.equivalence binary.equivalence //status.equivalence) ))