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
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'
-- 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)
help <- help_set
when (help) $ do
putStrLn help_text
- exitWith ExitSuccess
+ exitSuccess
-- Get the list of usernames.
usernames <- parse_usernames
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.