(.using [library [lux (.except Type) [abstract [equivalence (.only Equivalence)] [monad (.only do)]] [control ["<>" parser (.only) ["<[0]>" xml (.only Parser)] ["<[0]>" text]]] [data ["[0]" product] ["[0]" text] [format ["[0]" xml (.only XML)]]]]] ["[0]" /// ["[1][0]" type (.only Type)] ["[1][0]" time (.only Time)]]) (type: .public Version (Record [#extension Type #value Text #updated Time])) (def: .public equivalence (Equivalence Version) (all product.equivalence text.equivalence text.equivalence ///time.equivalence )) (template [ ] [(def: xml.Tag ["" ])] [ "extension"] [ "value"] [ "updated"] [ "snapshotVersion"] ) (def: (text_format tag value) (-> xml.Tag Text XML) (|> value {xml.#Text} list {xml.#Node tag xml.attributes})) (def: .public (format (open "_[0]")) (-> Version XML) (<| {xml.#Node .. xml.attributes} (list (..text_format .. _#extension) (..text_format .. _#value) (..text_format .. (///time.format _#updated))))) (def: (text tag) (-> xml.Tag (Parser Text)) (<| (.node tag) .text)) (def: .public parser (Parser Version) (<| (.node ..) (all <>.and (.somewhere (..text ..)) (.somewhere (..text ..)) (.somewhere (.then ///time.parser (..text ..))) )))