@@ -6,14 +6,29 @@ module Data.Intl.DateTimeFormat.Types
6 , FormatParts(..)
6 , FormatParts(..)
7 , readFormatParts
7 , readFormatParts
8 , ResolvedOptions(..)
8 , ResolvedOptions(..)
9+ , WeekdayYearMonthDayHourMinuteSecond(..)
10+ , WeekdayYearMonthDay(..)
14+ , HourMinuteSecond(..)
11import Data.Foreign (F, Foreign, ForeignError(..), fail, readString)
20import Data.Foreign (F, Foreign, ForeignError(..), fail, readString)
12import Data.Foreign.Index ((!))
21import Data.Foreign.Index ((!))
22+import Data.Generic (class Generic)
23+import Data.Intl.DateTimeFormat.Class (class FormatComponent)
24+import Data.Intl.DateTimeFormat.Generic (genericFormatComponent)
13import Data.Maybe (Maybe)
25import Data.Maybe (Maybe)
14import Data.Newtype (class Newtype)
26import Data.Newtype (class Newtype)
15import Prelude (class Show, bind, pure, ($), (<>), (>>=))
27import Prelude (class Show, bind, pure, ($), (<>), (>>=))
29+foreign import data Undefined :: Type
30+foreign import undefined :: Undefined
17data StringRep = Narrow | Short | Long
32data StringRep = Narrow | Short | Long
19instance showStringRep :: Show StringRep where
34instance showStringRep :: Show StringRep where
@@ -86,3 +101,82 @@ newtype ResolvedOptions = ResolvedOptions
88derive instance newtypeResolvedOptions :: Newtype ResolvedOptions _
103derive instance newtypeResolvedOptions :: Newtype ResolvedOptions _
105+newtype WeekdayYearMonthDayHourMinuteSecond = WeekdayYearMonthDayHourMinuteSecond
106+ { weekday :: StringRep
107+ , year :: NumericRep
110+ , hour :: NumericRep
111+ , minute :: NumericRep
112+ , second :: NumericRep
115+derive instance genericWeekdayYearMonthDayHourMinuteSecond :: Generic WeekdayYearMonthDayHourMinuteSecond _
117+instance formatComponentWeekdayYearMonthDayHourMinuteSecond :: FormatComponent WeekdayYearMonthDayHourMinuteSecond where
118+ formatComponent = genericFormatComponent
120+newtype WeekdayYearMonthDay = WeekdayYearMonthDay
121+ { weekday :: StringRep
122+ , year :: NumericRep
127+derive instance genericWeekdayYearMonthDay :: Generic WeekdayYearMonthDay _
129+instance formatComponentWeekdayYearMonthDay :: FormatComponent WeekdayYearMonthDay where
130+ formatComponent = genericFormatComponent
132+newtype YearMonthDay = YearMonthDay
133+ { year :: NumericRep
138+derive instance genericYearMonthDay :: Generic YearMonthDay _
140+instance formatComponentYearMonthDay :: FormatComponent YearMonthDay where
141+ formatComponent = genericFormatComponent
143+newtype YearMonth = YearMonth
144+ { year :: NumericRep
148+derive instance genericYearMonth :: Generic YearMonth _
150+instance formatComponentYearMonth :: FormatComponent YearMonth where
151+ formatComponent = genericFormatComponent
153+newtype MonthDay = MonthDay
158+derive instance genericMonthDay :: Generic MonthDay _
160+instance formatComponentMonthDay :: FormatComponent MonthDay where
161+ formatComponent = genericFormatComponent
163+newtype HourMinuteSecond = HourMinuteSecond
164+ { hour :: NumericRep
165+ , minute :: NumericRep
166+ , second :: NumericRep
169+derive instance genericHourMinuteSecond :: Generic HourMinuteSecond _
171+instance formatComponentHourMinuteSecond :: FormatComponent HourMinuteSecond where
172+ formatComponent = genericFormatComponent
174+newtype HourMinute = HourMinute
175+ { hour :: NumericRep
176+ , minute :: NumericRep
179+derive instance genericHourMinute :: Generic HourMinute _
181+instance formatComponentHourMinute :: FormatComponent HourMinute where
182+ formatComponent = genericFormatComponent