git.iko.soy/purescript-intl
on master help sign in
Data.Intl.DateTimeFormat.Generic - code style
873af03Marcin Szamotulski
src/Data/Intl/DateTimeFormat.purs+1−1
@@ -28,7 +28,7 @@ module Data.Intl.DateTimeFormat
28import Data.Intl.DateTimeFormat.Types
28import Data.Intl.DateTimeFormat.Types
29
29
30import Data.Generic.Rep (class Generic)
30import Data.Generic.Rep (class Generic)
31−import Data.Intl.DateTimeFormat.Class (class FormatComponent, defaultComponentRecord, formatComponent, genericFormatComponent)
31+import Data.Intl.DateTimeFormat.Generic (class FormatComponent, defaultComponentRecord, formatComponent, genericFormatComponent)
32import Data.JSDate (JSDate)
32import Data.JSDate (JSDate)
33import Data.Maybe (Maybe, fromMaybe, maybe)
33import Data.Maybe (Maybe, fromMaybe, maybe)
34import Data.Newtype (class Newtype)
34import Data.Newtype (class Newtype)
src/Data/Intl/DateTimeFormat/Class.purs → src/Data/Intl/DateTimeFormat/Generic.pursrenamed+31−11
@@ -1,4 +1,14 @@
1−module Data.Intl.DateTimeFormat.Class where
1+module Data.Intl.DateTimeFormat.Generic
2+ ( class FormatComponent
3+ , formatComponent
4+ , class GenericFormatComponent
5+ , genericFormatComponent'
6+ , genericFormatComponent
7+ , class GenericFormatComponentFields
8+ , genericFormatComponentFields
9+ , defaultComponentRecord
10+ , FormatComponentRecord
11+ ) where
2
12
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 =
20
30
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
32 }
42 }
33
43
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
45
55
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 =
58+ { era: Nothing
59+ , weekday: Nothing
60+ , year: Nothing
61+ , month: Nothing
62+ , day: Nothing
63+ , hour: Nothing
64+ , minute: Nothing
65+ , second: Nothing
66+ , timeZoneName: Nothing
67+ }
48
68
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