From 29861370dd56f59557c3bcecd53fba0f88a89792 Mon Sep 17 00:00:00 2001 From: Henning Thielemann Date: Sun, 1 Apr 2012 16:25:02 +0200 Subject: emit an error message when the --qual option is used incorrectly --- src/Haddock/Options.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Haddock/Options.hs') diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs index 3292ba16..537bffac 100644 --- a/src/Haddock/Options.hs +++ b/src/Haddock/Options.hs @@ -229,13 +229,16 @@ optLaTeXStyle :: [Flag] -> Maybe String optLaTeXStyle flags = optLast [ str | Flag_LaTeXStyle str <- flags ] -qualification :: [Flag] -> QualOption +qualification :: [Flag] -> Either String QualOption qualification flags = case map (map Char.toLower) [ str | Flag_Qualification str <- flags ] of - "full":_ -> OptFullQual - "local":_ -> OptLocalQual - "relative":_ -> OptRelativeQual - _ -> OptNoQual + [] -> Right OptNoQual + ["none"] -> Right OptNoQual + ["full"] -> Right OptFullQual + ["local"] -> Right OptLocalQual + ["relative"] -> Right OptRelativeQual + [arg] -> Left $ "unknown qualification type " ++ show arg + _:_ -> Left "qualification option given multiple times" verbosity :: [Flag] -> Verbosity -- cgit v1.2.3