aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-01-13 17:42:20 -0400
committerEduardo Julian2021-01-13 17:42:20 -0400
commitae56acf791c2ed9bd5865f85fffa00b025d310fe (patch)
treed02c6f67240b27c578b7e8ca17285824eae56497 /stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
parent71de092a045dc70ab1c9eead477cf1512b144a87 (diff)
Removed the (ultimately redundant) on_stop function for actors.
Diffstat (limited to 'stdlib/source/program/aedifex/artifact/snapshot/stamp.lux')
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/stamp.lux55
1 files changed, 55 insertions, 0 deletions
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
new file mode 100644
index 000000000..c1efcc8ee
--- /dev/null
+++ b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux
@@ -0,0 +1,55 @@
+(.module:
+ [lux #*
+ [abstract
+ [equivalence (#+ Equivalence)]]
+ [data
+ ["." product]
+ [format
+ [xml (#+ XML)]]]]
+ ["." // #_
+ ["#." time (#+ Time)]
+ ["#." build (#+ Build)]])
+
+(type: #export Stamp
+ {#time Time
+ #build Build})
+
+(def: #export equivalence
+ (Equivalence Stamp)
+ ($_ product.equivalence
+ //time.equivalence
+ //build.equivalence
+ ))
+
+(def: time_format
+ (-> Time XML)
+ (|>> //time.format
+ #xml.Text
+ list
+ (#xml.Node ..tag xml.attributes)))
+
+(def: #export (format (^slots [#time #build]))
+ (-> Stamp (List XML))
+ (list (..time_format time)
+ (//build.format build)))
+
+(def: <timestamp>
+ xml.Tag
+ ["" "timestamp"])
+
+## (exception: #export (mismatch {expected Instant} {actual Instant})
+## (exception.report
+## ["Expected" (%.instant expected)]
+## ["Actual" (%.instant actual)]))
+
+(def: time_parser
+ (Parser Time)
+ (do <>.monad
+ [_ (<xml>.node <timestamp>)]
+ (<text>.embed //time.parser
+ (<xml>.children <xml>.text))))
+
+(def: #export parser
+ (Parser Stamp)
+ (<>.and (<xml>.somewhere ..time_parser)
+ (<xml>.somewhere //build.parser)))