@@ -1,4 +1,14 @@
1−module Data.Intl.DateTimeFormat.Class where
1+module Data.Intl.DateTimeFormat.Generic
2+ ( class FormatComponent
4+ , class GenericFormatComponent
5+ , genericFormatComponent'
6+ , genericFormatComponent
7+ , class GenericFormatComponentFields
8+ , genericFormatComponentFields
9+ , defaultComponentRecord
10+ , FormatComponentRecord
3import Data.Generic.Rep (class Generic, Constructor(Constructor), Field(..), NoConstructors, Product(..), Rec(..), from)
13import Data.Generic.Rep (class Generic, Constructor(Constructor), Field(..), NoConstructors, Product(..), Rec(..), from)
4import Data.Intl.DateTimeFormat.Types (MonthRep, NumericRep, TimeZoneNameRep, StringRep)
14import Data.Intl.DateTimeFormat.Types (MonthRep, NumericRep, TimeZoneNameRep, StringRep)
@@ -20,15 +30,15 @@ type FormatComponentRecord =
21defaultComponentRecord :: FormatComponentRecord
31defaultComponentRecord :: FormatComponentRecord
22defaultComponentRecord =
32defaultComponentRecord =
23− { era : Nothing
33+ { era: Nothing
24− , weekday : Nothing
34+ , weekday: Nothing
25− , year : Nothing
35+ , year: Nothing
26− , month : Nothing
36+ , month: Nothing
27− , day : Nothing
37+ , day: Nothing
28− , hour : Nothing
38+ , hour: Nothing
29− , minute : Nothing
39+ , minute: Nothing
30− , second : Nothing
40+ , second: Nothing
31− , timeZoneName : Nothing
41+ , timeZoneName: Nothing
34class FormatComponent a where
44class FormatComponent a where
@@ -44,7 +54,17 @@ class GenericFormatComponentFields a where
44 genericFormatComponentFields :: a -> StrMap String
54 genericFormatComponentFields :: a -> StrMap String
46instance genericFormatComponentNoConsturctors :: GenericFormatComponent NoConstructors where
56instance genericFormatComponentNoConsturctors :: GenericFormatComponent NoConstructors where
47− genericFormatComponent' a = { era: Nothing, weekday: Nothing, year: Nothing, month: Nothing, day: Nothing, hour: Nothing, minute: Nothing, second: Nothing, timeZoneName: Nothing }
57+ genericFormatComponent' a =
66+ , timeZoneName: Nothing
49instance genericFormatComponentConstructor :: (GenericFormatComponent a) => GenericFormatComponent (Constructor name a) where
69instance genericFormatComponentConstructor :: (GenericFormatComponent a) => GenericFormatComponent (Constructor name a) where
50 genericFormatComponent' (Constructor a) = genericFormatComponent' a
70 genericFormatComponent' (Constructor a) = genericFormatComponent' a