diff options
author | davve <davve@dtek.chalmers.se> | 2007-01-18 23:39:28 +0000 |
---|---|---|
committer | davve <davve@dtek.chalmers.se> | 2007-01-18 23:39:28 +0000 |
commit | 288ed096e584def7a2a30767e4b6d76177f2f75c (patch) | |
tree | 1f4014cf269e2762c8e4febea2010c69a80aeec8 /src/Main.hs | |
parent | da242b2cff1010bef16bb5c5cd49aaf8d50ac2a5 (diff) |
Moved the defaultErrorHandler to scope only over sortAndCheckModules for now
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/Main.hs b/src/Main.hs index e8a45d58..8f61f8d9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -104,33 +104,31 @@ main = do -- initialize GHC (session, dynflags) <- startGHC libDir - defaultErrorHandler dynflags $ do + -- parse GHC flags given to the program + (dynflags', rest') <- if isGHCMode + then parseGHCFlags_GHCMode dynflags rest + else parseGHCFlags_HaddockMode dynflags rest + setSessionDynFlags session dynflags' - -- parse GHC flags given to the program - (dynflags', rest') <- if isGHCMode - then parseGHCFlags_GHCMode dynflags rest - else parseGHCFlags_HaddockMode dynflags rest - setSessionDynFlags session dynflags' + -- parse Haddock specific flags + (flags, fileArgs) <- parseHaddockOpts rest' - -- parse Haddock specific flags - (flags, fileArgs) <- parseHaddockOpts rest' + -- try to sort and check the input files using the GHC API + modules <- sortAndCheckModules session dynflags' fileArgs - -- try to sort and check the input files using the GHC API - modules <- sortAndCheckModules session dynflags' fileArgs + -- create a PackageData for each external package in the session + -- using the GHC API. The PackageData contains an html path, + -- a doc env and a list of module names. + packages <- getPackages session dynflags' flags - -- create a PackageData for each external package in the session - -- using the GHC API. The PackageData contains an html path, - -- a doc env and a list of module names. - packages <- getPackages session dynflags' flags + -- update the html references (module -> html file mapping) + updateHTMLXRefs packages - -- update the html references (module -> html file mapping) - updateHTMLXRefs packages + -- combine the doc envs of the external packages into one + let env = packagesDocEnv packages - -- combine the doc envs of the external packages into one - let env = packagesDocEnv packages - - -- TODO: continue to break up the run function into parts - run flags modules env + -- TODO: continue to break up the run function into parts + run flags modules env parseModeFlag :: [String] -> (Bool, [String]) parseModeFlag ("--ghc-flags":rest) = (True, rest) @@ -223,7 +221,7 @@ startGHC libDir = do return (session, flags'') sortAndCheckModules :: Session -> DynFlags -> [FilePath] -> IO [CheckedMod] -sortAndCheckModules session flags files = do --defaultErrorHandler flags $ do +sortAndCheckModules session flags files = defaultErrorHandler flags $ do targets <- mapM (\s -> guessTarget s Nothing) files setTargets session targets mbModGraph <- depanal session [] True |