aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/artifact
diff options
context:
space:
mode:
authorEduardo Julian2021-07-13 02:41:45 -0400
committerEduardo Julian2021-07-13 02:41:45 -0400
commit2431e767a09894c2f685911ba7f1ba0b7de2a165 (patch)
treef5c79fb04af80b8418e9de0a5e668f29403dd7fd /stdlib/source/program/aedifex/artifact
parent86bcfadb774618defaa27bbb9361a93d288fb985 (diff)
Improved the XML parsing library.
Diffstat (limited to 'stdlib/source/program/aedifex/artifact')
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot.lux14
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/build.lux8
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/stamp.lux7
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/version.lux11
-rw-r--r--stdlib/source/program/aedifex/artifact/versioning.lux17
5 files changed, 21 insertions, 36 deletions
diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux
index 836365fed..89897316d 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot.lux
@@ -49,10 +49,9 @@
(def: local_copy_parser
(Parser Any)
- (do <>.monad
- [_ (<xml>.node ..<local_copy>)]
- (<xml>.children (<text>.embed (<text>.this ..local_copy_value)
- <xml>.text))))
+ (<| (<xml>.node ..<local_copy>)
+ (<text>.embed (<text>.this ..local_copy_value))
+ <xml>.text))
(def: #export (format snapshot)
(-> Snapshot XML)
@@ -66,7 +65,6 @@
(def: #export parser
(Parser Snapshot)
- (do <>.monad
- [_ (<xml>.node <snapshot>)]
- (<xml>.children (<>.or ..local_copy_parser
- /stamp.parser))))
+ (<| (<xml>.node <snapshot>)
+ (<>.or ..local_copy_parser
+ /stamp.parser)))
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/build.lux b/stdlib/source/program/aedifex/artifact/snapshot/build.lux
index d9a8b729e..cd87c283e 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot/build.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot/build.lux
@@ -36,8 +36,6 @@
(def: #export parser
(Parser Build)
- (do <>.monad
- [_ (<xml>.node ..tag)]
- (<text>.embed (<>.codec nat.decimal
- (<text>.many <text>.decimal))
- (<xml>.children <xml>.text))))
+ (<| (<xml>.node ..tag)
+ (<text>.embed (<>.codec nat.decimal (<text>.many <text>.decimal)))
+ <xml>.text))
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
index f321e11c1..2d127af21 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
@@ -44,10 +44,9 @@
(def: time_parser
(Parser Time)
- (do <>.monad
- [_ (<xml>.node <timestamp>)]
- (<text>.embed //time.parser
- (<xml>.children <xml>.text))))
+ (<| (<xml>.node <timestamp>)
+ (<text>.embed //time.parser)
+ <xml>.text))
(def: #export parser
(Parser Stamp)
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux
index 905523bd0..806d2b261 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux
@@ -50,19 +50,14 @@
(..format_text ..<value> value)
(..format_text ..<updated> (///time.format updated)))))
-(def: (sub tag parser)
- (All [a] (-> xml.Tag (Parser a) (Parser a)))
- (do <>.monad
- [_ (<xml>.node tag)]
- (<xml>.children parser)))
-
(def: (text tag)
(-> xml.Tag (Parser Text))
- (..sub tag <xml>.text))
+ (<| (<xml>.node tag)
+ <xml>.text))
(def: #export parser
(Parser Version)
- (<| (..sub ..<snapshot_version>)
+ (<| (<xml>.node ..<snapshot_version>)
($_ <>.and
(<xml>.somewhere (..text ..<extension>))
(<xml>.somewhere (..text ..<value>))
diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux
index a16d92796..be192e9a5 100644
--- a/stdlib/source/program/aedifex/artifact/versioning.lux
+++ b/stdlib/source/program/aedifex/artifact/versioning.lux
@@ -69,29 +69,24 @@
(list\map //snapshot/version.format)
(#xml.Node ..<snapshot_versions> xml.attributes)))))
-(def: (sub tag parser)
- (All [a] (-> xml.Tag (Parser a) (Parser a)))
- (do <>.monad
- [_ (<xml>.node tag)]
- (<xml>.children parser)))
-
(def: (text tag)
(-> xml.Tag (Parser Text))
- (..sub tag <xml>.text))
+ (<| (<xml>.node tag)
+ <xml>.text))
(def: last_updated_parser
(Parser //time.Time)
- (<text>.embed //time.parser
- (..text ..<last_updated>)))
+ (<| (<text>.embed //time.parser)
+ (..text ..<last_updated>)))
(def: #export parser
(Parser Versioning)
- (<| (..sub ..<versioning>)
+ (<| (<xml>.node ..<versioning>)
($_ <>.and
(<>.default #//snapshot.Local (<xml>.somewhere //snapshot.parser))
(<>.default //time.epoch (<xml>.somewhere ..last_updated_parser))
(<| (<>.default (list))
<xml>.somewhere
- (..sub ..<snapshot_versions>)
+ (<xml>.node ..<snapshot_versions>)
(<>.some //snapshot/version.parser))
)))