compilerOpts :: [String] -> IO CompilerOpts
compilerOpts argv = case getOpt argorder options argv of
                     (o,_,[]) -> let opts = foldl (flip id) defaultOptions o
                                 in do
                                   mapM_ (doHandler opts) optionHandlers
                                   return opts
                     (_,_,errs) -> do putStr (concat errs ++ usageInfo usageHeader options)
                                      exitWith $ ExitFailure 1
  where
        argorder = ReturnInOrder (\s opts -> opts { inputFiles = inputFiles opts ++ [s] })


-- Option handling stuff
compilerOpts :: [String] -> IO CompilerOpts
compilerOpts argv = case getOpt argorder options argv of
                     (o,_,[]) -> let opts = foldl (flip id) defaultOptions o
                                 in do
                                   mapM_ (doHandler opts) optionHandlers
                                   return opts
                     (_,_,errs) -> do putStr (concat errs ++ usageInfo usageHeader options)
                                      exitWith $ ExitFailure 1
  where
        argorder = ReturnInOrder (\s opts -> opts { inputFiles = inputFiles opts ++ [s] })


-- Option handling stuff
compilerOpts argv = case getOpt argorder options argv of
                     (o,_,[]) -> let opts = foldl (flip id) defaultOptions o
                                 in do
                                   mapM_ (doHandler opts) optionHandlers
                                   return opts
                     (_,_,errs) -> do putStr (concat errs ++ usageInfo usageHeader options)
                                      exitWith $ ExitFailure 1
  where
        argorder = ReturnInOrder (\s opts -> opts { inputFiles = inputFiles opts ++ [s] })


-- Option handling stuff