]> gitweb.michael.orlitzky.com - dead/halcyon.git/blobdiff - src/Twitter/Status.hs
Clean up a bunch of code and comments.
[dead/halcyon.git] / src / Twitter / Status.hs
index 506a2c0bbe26ff67a561e7eee6b2e73d0629fb9f..ba27d527d44f14ceeb3c6766e326d24d8beae501 100644 (file)
@@ -36,8 +36,8 @@ data Status = Status {
   reply :: Bool,
   retweeted :: Bool,
   text :: String,
-  user :: User
-  } deriving (Show, Eq)
+  user :: User }
+  deriving (Eq, Show)
 
 type Timeline = [Status]
 
@@ -65,6 +65,8 @@ instance FromJSON Status where
   -- Do whatever.
   parseJSON _ = mempty
 
+-- | Parse a timestamp from a status into a UTCTime (or Nothing).
+--
 parse_status_time :: String -> Maybe UTCTime
 parse_status_time =
   parseTime defaultTimeLocale status_format
@@ -73,6 +75,10 @@ parse_status_time =
     status_format :: String
     status_format = "%a %b %d %H:%M:%S %z %Y"
 
+
+-- | Given a 'TimeZone', convert a 'UTCTime' into an RFC822-format
+--   time string. If no 'TimeZone' is given, assume UTC.
+--
 utc_time_to_rfc822 :: Maybe TimeZone -> UTCTime -> String
 utc_time_to_rfc822 mtz utc =
   case mtz of
@@ -82,10 +88,15 @@ utc_time_to_rfc822 mtz utc =
     foo = formatTime defaultTimeLocale rfc822DateFormat
 
 
+-- | Get the 'created_at' time out of a 'Status' and display it as an
+--   RFC822-format time string. If there's no created-at time in the
+--   status, you'll get an empty string instead.
+--
 show_created_at :: Maybe TimeZone -> Status -> String
 show_created_at mtz =
   (maybe "" (utc_time_to_rfc822 mtz)) . created_at
 
+
 -- | Returns a nicely-formatted String representing the given 'Status'
 --   object.
 --