X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-w3c.git;a=blobdiff_plain;f=Data%2FTime%2FW3C%2FTypes.hs;fp=Data%2FTime%2FW3CDateTime%2FTypes.hs;h=9f48f68be58dbc627f8f08a6e4d6b71a612f11e9;hp=c7573eb09814481b69bd9402e183d9282334790d;hb=fb743c0b822f29bac00c39e762ddd57dc65ee28f;hpb=b848b3a392e2666d06533ad937c92c4d28085114 diff --git a/Data/Time/W3CDateTime/Types.hs b/Data/Time/W3C/Types.hs similarity index 98% rename from Data/Time/W3CDateTime/Types.hs rename to Data/Time/W3C/Types.hs index c7573eb..9f48f68 100644 --- a/Data/Time/W3CDateTime/Types.hs +++ b/Data/Time/W3C/Types.hs @@ -1,4 +1,4 @@ -module Data.Time.W3CDateTime.Types +module Data.Time.W3C.Types ( W3CDateTime(..) ) where @@ -23,6 +23,16 @@ data W3CDateTime } deriving (Show, Eq, Typeable) +fetch :: (Show a, Typeable a, Typeable b) => + String + -> (a -> Maybe b) + -> a + -> ConvertResult b +fetch name f a + = case f a of + Nothing -> convError ("No " ++ name ++ " information in the given value") a + Just b -> return b + instance Convertible Day W3CDateTime where safeConvert day = case toGregorian day of @@ -36,16 +46,6 @@ instance Convertible Day W3CDateTime where , w3cTimeZone = Nothing } -fetch :: (Show a, Typeable a, Typeable b) => - String - -> (a -> Maybe b) - -> a - -> ConvertResult b -fetch name f a - = case f a of - Nothing -> convError ("No " ++ name ++ " information in the given value") a - Just b -> return b - instance Convertible W3CDateTime Day where safeConvert w3c = do let y = w3cYear w3c