aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Main.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Main.hs b/Main.hs
index 9c6ab3f..cfe5669 100644
--- a/Main.hs
+++ b/Main.hs
@@ -5,8 +5,10 @@ import Text.Printf
errorMessage :: String -> String
-errorMessage "" = "nd v1\nUsage: nd [-int, -prime, -factor, -hcf]"
-errorMessage reason = "nd v1\nFAILURE: " ++ reason ++ "\nUsage: nd [-int, -prime, -factor, -hcf]"
+errorMessage "" = "nd v1\nUsage: nd [-help, -int, -prime, -factor, -hcf]\n"
+errorMessage reason = "nd v1\nFAILURE: "
+ ++ reason
+ ++ "\nUsage: nd [-int, -prime, -factor, -hcf]\n"
flagHandlerF :: [String] -> Int -> String -> ([String] -> String) -> String
@@ -55,8 +57,9 @@ flagHandler "-hcf" args =
hcf = head $ reverse $ intersect (factors n) (factors m) in
"hcf(" ++ show n ++ ", " ++ show m ++ "): hcf=" ++ show hcf)
+flagHandler _ _ =
+ errorMessage "Flag not recognised"
-flagHandler _ _ = errorMessage "Didn't recognise flag"
main = do
args <- getArgs