From 94484087fbfe98d6735aa82798a9bf506f97fd19 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 28 Sep 2010 14:25:11 -0400 Subject: [PATCH] Whitespace cleanup. --- src/CommandLine.hs | 8 ++++---- src/Mail.hs | 2 +- src/Main.hs | 6 +++--- src/Twitter/Http.hs | 6 +++--- src/Twitter/Status.hs | 13 ++++++------- src/Twitter/User.hs | 2 +- src/Twitter/Xml.hs | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/CommandLine.hs b/src/CommandLine.hs index c5ddb4b..19b8d1b 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -45,7 +45,7 @@ options = Option ['t'][] (ReqArg set_to "email_address") "Send tweets TO email_address.", Option ['f'][] (ReqArg set_from "email_address") "Send tweets FROM email_address." ] - + set_help :: Options -> IO Options set_help opts = do @@ -58,7 +58,7 @@ set_to arg opts = do set_from :: String -> Options -> IO Options set_from arg opts = do return opts { opt_from = Just arg } - + -- The usage header. usage :: String @@ -120,7 +120,7 @@ format_error err = "ERROR: " ++ err ++ "\n" parse_errors :: IO [String] parse_errors = do argv <- getArgs - let (_, _, errors) = getOpt Permute options argv + let (_, _, errors) = getOpt Permute options argv errs_username <- username_errors errs_to <- to_errors errs_from <- from_errors @@ -143,7 +143,7 @@ from_email_address = do opts <- parse_options return (opt_from opts) - + parse_usernames :: IO [String] parse_usernames = do argv <- getArgs diff --git a/src/Mail.hs b/src/Mail.hs index 2b5445c..c280f1e 100644 --- a/src/Mail.hs +++ b/src/Mail.hs @@ -27,7 +27,7 @@ instance Show Message where "\n", (body m) ] - + sendmail :: Message -> IO (String, String, ExitCode) sendmail message = do let sendmail_args = ["-f", diff --git a/src/Main.hs b/src/Main.hs index 8c2f20b..84536d7 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -79,8 +79,8 @@ get_latest_status_id username = do run_twat :: Maybe Message -> String -> IO () -run_twat message username = do - latest_status_id <- get_latest_status_id username +run_twat message username = do + latest_status_id <- get_latest_status_id username recurse username latest_status_id message return () @@ -123,7 +123,7 @@ main = do -- Execute run_twat on each username in a new thread. mapM (forkIO . (run_twat message)) usernames - + forever $ do -- This thread (the one executing main) doesn't do anything, -- but when it terminates, so do all the threads we forked. diff --git a/src/Twitter/Http.hs b/src/Twitter/Http.hs index ddd6828..2fe24bd 100644 --- a/src/Twitter/Http.hs +++ b/src/Twitter/Http.hs @@ -4,7 +4,7 @@ where import Network.Curl import System.IO (hPutStrLn, stderr) --- +-- -- http://dev.twitter.com/doc/get/statuses/user_timeline -- user_timeline_url :: String -> String @@ -19,7 +19,7 @@ user_new_statuses_url username last_status_id = concat [ user_timeline_url username, "&since_id=" ++ (show last_status_id) ] - + get_user_timeline :: String -> IO (Maybe String) get_user_timeline username = do let uri = (user_timeline_url username) @@ -33,7 +33,7 @@ get_user_new_statuses username last_status_id = do new_statuses <- (http_get uri) return new_statuses - + http_get :: String -> IO (Maybe String) http_get uri = withCurlDo $ do resp <- curlGetString uri [CurlTimeout 45] diff --git a/src/Twitter/Status.hs b/src/Twitter/Status.hs index 275e893..93b3f4e 100644 --- a/src/Twitter/Status.hs +++ b/src/Twitter/Status.hs @@ -15,7 +15,6 @@ data Status = Status { status_id :: Integer, - status_from_content :: Content -> (Maybe Status) status_from_content content = @@ -38,19 +37,19 @@ status_from_content content = case (reads status_id_data :: [(Integer, String)]) of [] -> Nothing parseresult:_ -> Just (Status (fst parseresult) created_at_data all_text user_object) - + where status_ids = (unique_id content) first_status_id = get_char_data (status_ids !! 0) - + created_ats = (status_created_at content) - first_created_at = get_char_data (created_ats !! 0) + first_created_at = get_char_data (created_ats !! 0) texts = (status_text content) all_text = concat $ catMaybes (map get_char_data texts) - + users = (status_user content) - first_user = user_from_content (users !! 0) + first_user = user_from_content (users !! 0) @@ -86,7 +85,7 @@ pretty_print status = get_max_status_id :: [Status] -> Integer -get_max_status_id statuses = +get_max_status_id statuses = maximum status_ids where status_ids = map status_id statuses \ No newline at end of file diff --git a/src/Twitter/User.hs b/src/Twitter/User.hs index 75cf4b6..217ee7d 100644 --- a/src/Twitter/User.hs +++ b/src/Twitter/User.hs @@ -8,7 +8,7 @@ import Twitter.Xml data User = User { screen_name :: String } deriving (Show, Eq) - + user_from_content :: Content -> (Maybe User) user_from_content c = if (length names) == 0 diff --git a/src/Twitter/Xml.hs b/src/Twitter/Xml.hs index 09013bf..e4cf5ac 100644 --- a/src/Twitter/Xml.hs +++ b/src/Twitter/Xml.hs @@ -26,7 +26,7 @@ status_text = keep /> (tag "text") /> txt status_user :: CFilter status_user = keep /> (tag "user") - + user_screen_name :: CFilter user_screen_name = keep /> (tag "screen_name") /> txt -- 2.44.2