optOpt :: String -> OptFlags -> OptFlags
optOpt s opts = case s of
                 "none" -> S.empty
                 '-':name -> opts S.\\ optLookup name
                 name -> opts `S.union` optLookup name
  where optLookup name = case lookup name optimizationClasses of
                          Just s -> S.fromList s
                          Nothing -> case lookup name optimizations of
                                      Just _ -> S.singleton name
                                      Nothing -> S.empty

-- | Takes an argument list and gives a 'CompilerOpts'.  If there is a
-- parse error or help request, this function uses 'System.Exit' to
-- halt the entire program.
optOpt :: String -> OptFlags -> OptFlags
optOpt s opts = case s of
                 "none" -> S.empty
                 '-':name -> opts S.\\ optLookup name
                 name -> opts `S.union` optLookup name
  where optLookup name = case lookup name optimizationClasses of
                          Just s -> S.fromList s
                          Nothing -> case lookup name optimizations of
                                      Just _ -> S.singleton name
                                      Nothing -> S.empty

-- | Takes an argument list and gives a 'CompilerOpts'.  If there is a
-- parse error or help request, this function uses 'System.Exit' to
-- halt the entire program.
optOpt s opts = case s of
                 "none" -> S.empty
                 '-':name -> opts S.\\ optLookup name
                 name -> opts `S.union` optLookup name
  where optLookup name = case lookup name optimizationClasses of
                          Just s -> S.fromList s
                          Nothing -> case lookup name optimizations of
                                      Just _ -> S.singleton name
                                      Nothing -> S.empty

-- | Takes an argument list and gives a 'CompilerOpts'.  If there is a
-- parse error or help request, this function uses 'System.Exit' to
-- halt the entire program.