@@ -18,10 +18,14 @@ import Prelude
18
18
, compare
19
19
, show )
20
20
21
+ import Data.Generic
22
+
21
23
-- | An hour component from a time value. Should fall between 0 and 23
22
24
-- | inclusive.
23
25
newtype HourOfDay = HourOfDay Int
24
26
27
+ derive instance genericHourOfDay :: Generic HourOfDay
28
+
25
29
instance eqHourOfDay :: Eq HourOfDay where
26
30
eq (HourOfDay x) (HourOfDay y) = x == y
27
31
@@ -31,6 +35,8 @@ instance ordHourOfDay :: Ord HourOfDay where
31
35
-- | A quantity of hours (not necessarily a value between 0 and 23).
32
36
newtype Hours = Hours Number
33
37
38
+ derive instance genericHours :: Generic Hours
39
+
34
40
instance eqHours :: Eq Hours where
35
41
eq (Hours x) (Hours y) = x == y
36
42
@@ -61,6 +67,8 @@ instance showHours :: Show Hours where
61
67
-- | inclusive.
62
68
newtype MinuteOfHour = MinuteOfHour Int
63
69
70
+ derive instance genericMinuteOfHour :: Generic MinuteOfHour
71
+
64
72
instance eqMinuteOfHour :: Eq MinuteOfHour where
65
73
eq (MinuteOfHour x) (MinuteOfHour y) = x == y
66
74
@@ -70,6 +78,8 @@ instance ordMinuteOfHour :: Ord MinuteOfHour where
70
78
-- | A quantity of minutes (not necessarily a value between 0 and 60).
71
79
newtype Minutes = Minutes Number
72
80
81
+ derive instance genericMinutes :: Generic Minutes
82
+
73
83
instance eqMinutes :: Eq Minutes where
74
84
eq (Minutes x) (Minutes y) = x == y
75
85
@@ -100,6 +110,8 @@ instance showMinutes :: Show Minutes where
100
110
-- | inclusive.
101
111
newtype SecondOfMinute = SecondOfMinute Int
102
112
113
+ derive instance genericSecondOfMinute :: Generic SecondOfMinute
114
+
103
115
instance eqSecondOfMinute :: Eq SecondOfMinute where
104
116
eq (SecondOfMinute x) (SecondOfMinute y) = x == y
105
117
@@ -109,6 +121,8 @@ instance ordSecondOfMinute :: Ord SecondOfMinute where
109
121
-- | A quantity of seconds (not necessarily a value between 0 and 60).
110
122
newtype Seconds = Seconds Number
111
123
124
+ derive instance genericSeconds :: Generic Seconds
125
+
112
126
instance eqSeconds :: Eq Seconds where
113
127
eq (Seconds x) (Seconds y) = x == y
114
128
@@ -139,6 +153,8 @@ instance showSeconds :: Show Seconds where
139
153
-- | inclusive.
140
154
newtype MillisecondOfSecond = MillisecondOfSecond Int
141
155
156
+ derive instance genericMillisecondOfSecond :: Generic MillisecondOfSecond
157
+
142
158
instance eqMillisecondOfSecond :: Eq MillisecondOfSecond where
143
159
eq (MillisecondOfSecond x) (MillisecondOfSecond y) = x == y
144
160
@@ -148,6 +164,8 @@ instance ordMillisecondOfSecond :: Ord MillisecondOfSecond where
148
164
-- | A quantity of milliseconds (not necessarily a value between 0 and 1000).
149
165
newtype Milliseconds = Milliseconds Number
150
166
167
+ derive instance genericMilliseconds :: Generic Milliseconds
168
+
151
169
instance eqMilliseconds :: Eq Milliseconds where
152
170
eq (Milliseconds x) (Milliseconds y) = x == y
153
171
0 commit comments