X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FPicklers.hs;h=ea335c81f2894e8de38a44bddea3c5b2938f82c4;hb=d63540c64bf8f20677ae878f11bf5a85a393d9df;hp=ff7b0d1e677e9cff2c9cd469c77e226be272a2a6;hpb=6062e1f8ae4d894699bb9d1f552b36af0151b5bb;p=dead%2Fhtsn-import.git diff --git a/src/TSN/Picklers.hs b/src/TSN/Picklers.hs index ff7b0d1..ea335c8 100644 --- a/src/TSN/Picklers.hs +++ b/src/TSN/Picklers.hs @@ -35,8 +35,9 @@ import TSN.Parse ( -- | The format string for a base date in m/d/yyyy format. The -- day/month are not padded at all. This will match for example, -- --- * 2/15/1983 --- * 1/1/0000 +-- * 2\/15\/1983 +-- +-- * 1\/1\/0000 -- date_format :: String date_format = "%-m/%-d/%Y" @@ -46,8 +47,9 @@ date_format = "%-m/%-d/%Y" -- day/month are padded to two characters with zeros. This will -- match for example, -- --- * 02/15/1983 --- * 01/01/0000 +-- * 02\/15\/1983 +-- +-- * 01\/01\/0000 -- date_format_padded :: String date_format_padded = "%0m/%0d/%Y" @@ -108,9 +110,11 @@ format_commas x = -- | Parse \ from an 'AutoRaceResultsListing'. These are -- essentially 'Int's, but they look like, -- --- * 336,826 --- * 1,000,191 --- * TBA +-- * \336,826\ +-- +-- * \1,000,191\ +-- +-- * \TBA\ -- xp_earnings :: PU (Maybe Int) xp_earnings = @@ -122,7 +126,7 @@ xp_earnings = to_earnings :: String -> Maybe Int to_earnings s | s == "TBA" = Nothing - | otherwise = (read . strip_commas . show) s + | otherwise = Just $ (read . strip_commas) s from_earnings :: Maybe Int -> String from_earnings Nothing = "TBA" @@ -132,10 +136,11 @@ xp_earnings = -- | (Un)pickle a 'UTCTime' from a \ element in an -- 'AutoRaceResults' message. -- --- Example: +-- Examples: +-- +-- * \6/1/2014 1:00:00 PM\ -- --- 6/1/2014 1:00:00 PM --- 5/24/2014 2:45:00 PM +-- * \5/24/2014 2:45:00 PM\ -- xp_racedate :: PU UTCTime xp_racedate = @@ -227,7 +232,7 @@ xp_tba_time = | otherwise = parseTime defaultTimeLocale time_format s from_time :: Maybe UTCTime -> String - from_time Nothing = "" + from_time Nothing = "TBA" from_time (Just t) = formatTime defaultTimeLocale time_format t