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