diff options
author | Thomas Schilling <nominolo@googlemail.com> | 2008-09-15 09:11:00 +0000 |
---|---|---|
committer | Thomas Schilling <nominolo@googlemail.com> | 2008-09-15 09:11:00 +0000 |
commit | c8ba22124636eaf60c439e2ac2642b72d72145a2 (patch) | |
tree | 52a44d8c9c242406ad0acdd1749c5dbd59bdeae7 /src | |
parent | e5f944b9ddda55f6c789cc9ee372e0f3b1b8826f (diff) |
Port Haddock.GHC to new GHC API.
Diffstat (limited to 'src')
-rw-r--r-- | src/Haddock/GHC.hs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Haddock/GHC.hs b/src/Haddock/GHC.hs index 66bd3b1f..ff1c58e4 100644 --- a/src/Haddock/GHC.hs +++ b/src/Haddock/GHC.hs @@ -30,25 +30,25 @@ import SrcLoc -- | Start a GHC session with the -haddock flag set. Also turn off -- compilation and linking. -startGhc :: String -> [String] -> IO (Session, DynFlags) -startGhc libDir flags = do +startGhc :: String -> [String] -> (DynFlags -> Ghc a) -> IO a +startGhc libDir flags ghcActs = do -- TODO: handle warnings? #if __GLASGOW_HASKELL__ >= 609 (restFlags, _) <- parseStaticFlags (map noLoc flags) #else restFlags <- parseStaticFlags flags #endif - session <- newSession (Just libDir) - dynflags <- getSessionDynFlags session - let dynflags' = dopt_set dynflags Opt_Haddock - let dynflags'' = dynflags' { - hscTarget = HscAsm, - ghcMode = CompManager, - ghcLink = NoLink - } - dynflags''' <- parseGhcFlags dynflags'' restFlags flags - setSessionDynFlags session dynflags''' - return (session, dynflags''') + runGhc (Just libDir) $ do + dynflags <- getSessionDynFlags + let dynflags' = dopt_set dynflags Opt_Haddock + let dynflags'' = dynflags' { + hscTarget = HscAsm, + ghcMode = CompManager, + ghcLink = NoLink + } + dynflags''' <- parseGhcFlags dynflags'' restFlags flags + setSessionDynFlags dynflags''' + ghcActs dynflags''' -- | Expose the list of packages to GHC. Then initialize GHC's package state |