X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FMain.hs;fp=src%2FMain.hs;h=14539c11a737defc430d35e8aed0491c9d3cb397;hp=8c81555c60075952980b48198d3ee1f38ab5ec7e;hb=dd6cea3dc5e830691b1da442fcf91602e4cf94aa;hpb=4cc476a2714260980899ca5358196bbf5226b3c2 diff --git a/src/Main.hs b/src/Main.hs index 8c81555..14539c1 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -2,11 +2,11 @@ module Main where import Control.Concurrent (forkIO, threadDelay) -import Control.Monad (forever, when) +import Control.Monad (forever, unless, when) import Data.Aeson (decode) import Data.List ((\\)) import Data.Time.LocalTime (TimeZone, getCurrentTimeZone) -import System.Exit (ExitCode(..), exitWith) +import System.Exit (ExitCode(..), exitSuccess, exitWith) import System.IO (hPutStrLn, stderr) import CommandLine @@ -85,13 +85,13 @@ filter_statuses cfg ss = replies = filter reply ss retweets = filter retweeted ss - good_statuses' = case (ignore_replies cfg) of - True -> ss \\ replies - False -> ss + good_statuses' = if (ignore_replies cfg) + then ss \\ replies + else ss - good_statuses = case (ignore_retweets cfg) of - True -> good_statuses' \\ retweets - False -> good_statuses' + good_statuses = if (ignore_retweets cfg) + then good_statuses' \\ retweets + else good_statuses' @@ -189,7 +189,7 @@ main = do -- If there were errors parsing the command-line options, -- print them and exit. - when (not (null errors)) $ do + unless (null errors) $ do hPutStrLn stderr (concat errors) putStrLn help_text exitWith (ExitFailure exit_args_parse_failed) @@ -199,7 +199,7 @@ main = do help <- help_set when (help) $ do putStrLn help_text - exitWith ExitSuccess + exitSuccess -- Get the list of usernames. usernames <- parse_usernames @@ -215,7 +215,7 @@ main = do let run_twat_curried = run_twat cfg message _ <- mapM (forkIO . run_twat_curried) usernames - _ <- forever $ do + _ <- forever $ -- This thread (the one executing main) doesn't do anything, -- but when it terminates, so do all the threads we forked. -- As a result, we need to keep this thread on life support.