(.module: [library [lux #* ["." time] [abstract [monad (#+ do)]] [control ["<>" parser ["<.>" text (#+ Parser)]]] [data [text ["%" format]]] [math [number ["n" nat]]]]] ["." // #_ ["#" date]]) (type: .public Time time.Time) (def: .public (format value) (%.Format Time) (let [(^slots [#time.hour #time.minute #time.second]) (time.clock value)] (%.format (//.pad hour) (//.pad minute) (//.pad second)))) (def: .public parser (.Parser Time) (do <>.monad [hour (<>.codec n.decimal (.exactly 2 .decimal)) minute (<>.codec n.decimal (.exactly 2 .decimal)) second (<>.codec n.decimal (.exactly 2 .decimal))] (<>.lifted (time.time [#time.hour hour #time.minute minute #time.second second #time.milli_second 0]))))