]> gitweb.michael.orlitzky.com - dead/halcyon.git/blobdiff - src/CommandLine.hs
Fix remaining hlint suggestions.
[dead/halcyon.git] / src / CommandLine.hs
index db3b12da2039c6de2d046bf04e22782849b32649..0b081bc5a7d752fefe85652d0c1f6e92bd124466 100644 (file)
@@ -150,7 +150,7 @@ set_heartbeat arg opts = do
   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
@@ -211,19 +211,14 @@ parse_options = do
 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.
@@ -231,9 +226,8 @@ to_errors :: IO [String]
 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.
@@ -241,9 +235,7 @@ sendmail_path_errors :: IO [String]
 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.
@@ -251,9 +243,8 @@ from_errors :: IO [String]
 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.