diff options
author | David Waern <david.waern@gmail.com> | 2008-10-10 20:33:38 +0000 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2008-10-10 20:33:38 +0000 |
commit | ff03f4f8b4ac1b9ccd9ef93c294ac835871c349f (patch) | |
tree | 3cee68382d8029088b54154188c7396cf563731d /src/Haddock/GHC.hs | |
parent | 8a57f3d9eb971ab4957f2780ed7a0b5be0b3b6e3 (diff) |
Make Haddock build with GHC 6.8.2
Diffstat (limited to 'src/Haddock/GHC.hs')
-rw-r--r-- | src/Haddock/GHC.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Haddock/GHC.hs b/src/Haddock/GHC.hs index ff1c58e4..c53c3a83 100644 --- a/src/Haddock/GHC.hs +++ b/src/Haddock/GHC.hs @@ -30,16 +30,21 @@ import SrcLoc -- | Start a GHC session with the -haddock flag set. Also turn off -- compilation and linking. +#if __GLASGOW_HASKELL__ >= 609 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) + runGhc (Just libDir) $ do + dynflags <- getSessionDynFlags #else +startGhc :: String -> [String] -> IO (Session, DynFlags) +startGhc libDir flags = do restFlags <- parseStaticFlags flags + session <- newSession (Just libDir) + dynflags <- getSessionDynFlags session + do #endif - runGhc (Just libDir) $ do - dynflags <- getSessionDynFlags let dynflags' = dopt_set dynflags Opt_Haddock let dynflags'' = dynflags' { hscTarget = HscAsm, @@ -47,8 +52,13 @@ startGhc libDir flags ghcActs = do ghcLink = NoLink } dynflags''' <- parseGhcFlags dynflags'' restFlags flags +#if __GLASGOW_HASKELL__ >= 609 setSessionDynFlags dynflags''' ghcActs dynflags''' +#else + setSessionDynFlags session dynflags''' + return (session, dynflags''') +#endif -- | Expose the list of packages to GHC. Then initialize GHC's package state |