return opts { opt_heartbeat = new_heartbeat }
set_help :: Options -> IO Options
-set_help opts = do
+set_help opts =
return opts { opt_help = True }
set_ignore_retweets :: Options -> IO Options
heartbeat_errors :: IO [String]
heartbeat_errors = do
hb <- parse_heartbeat
- if (isNothing hb)
- then return ["\"heartbeat\" does not appear to be an integer."]
- else return []
+ return ["\"heartbeat\" does not appear to be an integer." | isNothing hb ]
-- | Parse errors relating to the list of usernames.
username_errors :: IO [String]
username_errors = do
argv <- getArgs
let (_, usernames, _) = getOpt Permute options argv
-
- if (null usernames)
- then return ["no usernames provided."]
- else return []
+ return [ "no usernames provided." | null usernames ]
-- | Parse errors relating to the "To" address.
to_errors = do
toaddr <- parse_to_address
fromaddr <- parse_from_address
- if (isNothing toaddr) && (isJust fromaddr)
- then return ["\"from\" address specified without \"to\" address."]
- else return []
+ return ["\"from\" address specified without \"to\" address."
+ | (isNothing toaddr) && (isJust fromaddr) ]
-- | Errors for the sendmail path argument.
sendmail_path_errors = do
sendmail <- parse_sendmail_path
exists <- doesFileExist sendmail
- if (not exists)
- then return ["sendmail path does not exist"]
- else return []
+ return [ "sendmail path does not exist" | not exists ]
-- | Parse errors relating to the "From" address.
from_errors = do
toaddr <- parse_to_address
fromaddr <- parse_from_address
- if (isJust toaddr) && (isNothing fromaddr)
- then return ["\"to\" address specified without \"from\" address."]
- else return []
+ return [ "\"to\" address specified without \"from\" address."
+ | (isJust toaddr) && (isNothing fromaddr) ]
-- | Format an error message for printing.