From c03bd9f9787fb9f383c57b4ebb0fa9d49abbfaa1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 3 Jan 2021 07:48:12 -0400 Subject: Place the "program:" macro of "lux/control/parser/cli" in its own module. --- .../source/program/aedifex/artifact/time_stamp.lux | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 stdlib/source/program/aedifex/artifact/time_stamp.lux (limited to 'stdlib/source/program/aedifex/artifact/time_stamp.lux') diff --git a/stdlib/source/program/aedifex/artifact/time_stamp.lux b/stdlib/source/program/aedifex/artifact/time_stamp.lux new file mode 100644 index 000000000..0eab45a14 --- /dev/null +++ b/stdlib/source/program/aedifex/artifact/time_stamp.lux @@ -0,0 +1,35 @@ +(.module: + [lux #* + [abstract + [monad (#+ do)]] + [control + ["<>" parser + ["<.>" text (#+ Parser)]]] + [data + [text + ["%" format]]] + [time + ["." instant (#+ Instant)]]] + ["." / #_ + ["#." date] + ["#." time]]) + +(type: #export Time_Stamp + Instant) + +(def: #export separator + ".") + +(def: #export (format value) + (%.Format Time_Stamp) + (%.format (/date.format (instant.date value)) + ..separator + (/time.format (instant.time value)))) + +(def: #export parser + (Parser Time_Stamp) + (do <>.monad + [date /date.parser + _ (.this ..separator) + time /time.parser] + (wrap (instant.from_date_time date time)))) -- cgit v1.2.3