startswith "Requires at least" s
-show_help :: IO (CmdArgs Args)
-show_help = withArgs ["--help"] parse_args
+show_help :: IO Args
+show_help = withArgs ["--help"] apply_args
parse_args :: IO (CmdArgs Args)
parse_args = do
Right result -> return result
Left err ->
if (is_missing_arg_error err) then
- -- Disregard the error message, show help instead.
- show_help
+ -- Disregard the error message, show help instead. We can't
+ -- reuse show_help here because of its return type.
+ withArgs ["--help"] parse_args
else do
hPutStrLn stderr err
exitWith (ExitFailure exit_args_parse_failed)