From 1797521191746640e761cc1b4973d46b8c403dee Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 28 Jan 2021 20:14:11 -0400 Subject: Implemented arithmetic right-shift in terms of logic right-shift. --- .../program/aedifex/artifact/snapshot/version.lux | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 stdlib/source/program/aedifex/artifact/snapshot/version.lux (limited to 'stdlib/source/program/aedifex') diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux new file mode 100644 index 000000000..905523bd0 --- /dev/null +++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux @@ -0,0 +1,71 @@ +(.module: + [lux (#- Type) + [abstract + [equivalence (#+ Equivalence)] + [monad (#+ do)]] + [control + ["<>" parser + ["<.>" xml (#+ Parser)] + ["<.>" text]]] + [data + ["." product] + ["." text] + [format + ["." xml (#+ XML)]]]] + ["." /// #_ + ["#." type (#+ Type)] + ["#." time (#+ Time)]]) + +(type: #export Version + {#extension Type + #value Text + #updated Time}) + +(def: #export equivalence + (Equivalence Version) + ($_ product.equivalence + text.equivalence + text.equivalence + ///time.equivalence + )) + +(template [ ] + [(def: xml.Tag ["" ])] + + [ "extension"] + [ "value"] + [ "updated"] + + [ "snapshotVersion"] + ) + +(def: (format_text tag value) + (-> xml.Tag Text XML) + (|> value #xml.Text list (#xml.Node tag xml.attributes))) + +(def: #export (format (^slots [#extension #value #updated])) + (-> Version XML) + (<| (#xml.Node .. xml.attributes) + (list (..format_text .. extension) + (..format_text .. value) + (..format_text .. (///time.format updated))))) + +(def: (sub tag parser) + (All [a] (-> xml.Tag (Parser a) (Parser a))) + (do <>.monad + [_ (.node tag)] + (.children parser))) + +(def: (text tag) + (-> xml.Tag (Parser Text)) + (..sub tag .text)) + +(def: #export parser + (Parser Version) + (<| (..sub ..) + ($_ <>.and + (.somewhere (..text ..)) + (.somewhere (..text ..)) + (.somewhere (.embed ///time.parser + (..text ..))) + ))) -- cgit v1.2.3