aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2018-05-02 00:28:19 -0400
committerEduardo Julian2018-05-02 00:28:19 -0400
commit7237639429cf766ca63cdcfd87a603fa0616f29d (patch)
tree027699dc68ddc3026ffc2a01f5540d42b4ed79d4
parent0144da58ba856bd6f6072b588bbd076c9c3fdb36 (diff)
- Implemented Monoid for Duration.
-rw-r--r--stdlib/source/lux/time/duration.lux5
1 files changed, 5 insertions, 0 deletions
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<Text,Int> Number<Int>]
@@ -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<Duration> = empty duration)