From 7237639429cf766ca63cdcfd87a603fa0616f29d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 2 May 2018 00:28:19 -0400 Subject: - Implemented Monoid for Duration. --- stdlib/source/lux/time/duration.lux | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'stdlib') diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index 4537ba8d5..a91553544 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -3,6 +3,7 @@ (lux (control eq order codec + [monoid #+ Monoid] ["p" parser] [monad #+ do]) (data [number "int/" Codec Number] @@ -76,6 +77,10 @@ (def: #export normal-year Duration (scale 365 day)) (def: #export leap-year Duration (merge day normal-year)) +(struct: #export _ (Monoid Duration) + (def: identity empty) + (def: compose merge)) + (def: (encode duration) (-> Duration Text) (if (:: Eq = empty duration) -- cgit v1.2.3