X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-w3c.git;a=blobdiff_plain;f=Data%2FTime%2FW3CDateTime.hs;h=b1c1230b7729d0f5a8fe761c944621acce6621e0;hp=a0de70ee8d554b19a22eff6f2d83e4772d4bedbf;hb=b848b3a392e2666d06533ad937c92c4d28085114;hpb=0094b747a40329d173a21eb8faa72d89abe35444 diff --git a/Data/Time/W3CDateTime.hs b/Data/Time/W3CDateTime.hs index a0de70e..b1c1230 100644 --- a/Data/Time/W3CDateTime.hs +++ b/Data/Time/W3CDateTime.hs @@ -1,55 +1,6 @@ module Data.Time.W3CDateTime - ( W3CDateTime + ( W3CDateTime(..) ) where -import Data.Convertible -import Data.Fixed -import Data.Time -import Data.Typeable - - --- This data type is /partially ordered/ so we can't make it an --- instance of Ord (e.g. "2010" and "2010-01" can't be compared). -data W3CDateTime - = W3CDateTime { - w3cYear :: !Integer - , w3cMonth :: !(Maybe Int) - , w3cDay :: !(Maybe Int) - , w3cHour :: !(Maybe Int) - , w3cMinute :: !(Maybe Int) - , w3cSecond :: !(Maybe Pico) - , w3cTimeZone :: !(Maybe TimeZone) - } - deriving (Show, Eq, Typeable) - -empty :: W3CDateTime -empty = W3CDateTime { - w3cYear = 0 - , w3cMonth = Nothing - , w3cDay = Nothing - , w3cHour = Nothing - , w3cMinute = Nothing - , w3cSecond = Nothing - , w3cTimeZone = Nothing - } - -instance Convertible Day W3CDateTime where - safeConvert day - = case toGregorian day of - (y, m, d) -> return empty { - w3cYear = y - , w3cMonth = Just m - , w3cDay = Just d - } - -instance Convertible W3CDateTime Day where - safeConvert w3c - = do let y = w3cYear w3c - m <- case w3cMonth w3c of - Just m -> return m - Nothing -> convError "No month info" w3c - d <- case w3cDay w3c of - Just d -> return d - Nothing -> convError "No day info" w3c - return $ fromGregorian y m d \ No newline at end of file +import Data.Time.W3CDateTime.Types