(.module: [library [lux "*" ["[0]" time] [abstract [monad {"+" do}]] [control ["<>" parser ["<[0]>" text {"+" Parser}]]] [data [text ["%" format]]] [math [number ["n" nat]]]]] ["[0]" // "_" ["[1]" 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]))))