diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/artifact/time.lux | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/stdlib/source/program/aedifex/artifact/time.lux b/stdlib/source/program/aedifex/artifact/time.lux new file mode 100644 index 000000000..19eb417a5 --- /dev/null +++ b/stdlib/source/program/aedifex/artifact/time.lux @@ -0,0 +1,35 @@ +(.module: + [lux #* + [abstract + [equivalence (#+ Equivalence)] + [monad (#+ do)]] + [control + ["<>" parser + ["<.>" text (#+ Parser)]]] + [data + [text + ["%" format (#+ Format)]]] + [time + ["." instant (#+ Instant)]]] + ["." / #_ + ["#." date] + ["#." time]]) + +(type: #export Time + Instant) + +(def: #export equivalence + (Equivalence Time) + instant.equivalence) + +(def: #export (format value) + (Format Time) + (%.format (/date.format (instant.date value)) + (/time.format (instant.time value)))) + +(def: #export parser + (Parser Time) + (do <>.monad + [date /date.parser + time /time.parser] + (wrap (instant.from_date_time date time)))) |