From 6cad3e8c495cb6b6630c6962a5e8c6673d095a2b Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 27 Oct 2010 11:09:44 +0000 Subject: follow changes in the GHC API --- src/Haddock/GhcUtils.hs | 5 ++++- src/Haddock/Interface/AttachInstances.hs | 11 +++++++++-- src/Haddock/InterfaceFile.hs | 3 +++ src/Haddock/Lex.x | 4 ++++ 4 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs index fdc9a5c3..9c5090af 100644 --- a/src/Haddock/GhcUtils.hs +++ b/src/Haddock/GhcUtils.hs @@ -29,8 +29,11 @@ import Name import Packages import Module import RdrName (GlobalRdrEnv) +#if MIN_VERSION_ghc(7,1,0) +import GhcMonad (withSession) +#endif import HscTypes -#if __GLASGOW_HASKELL__ >= 613 +#if MIN_VERSION_ghc(6,13,0) import UniqFM #else import LazyUniqFM diff --git a/src/Haddock/Interface/AttachInstances.hs b/src/Haddock/Interface/AttachInstances.hs index fd1e86d9..cc2dfa19 100644 --- a/src/Haddock/Interface/AttachInstances.hs +++ b/src/Haddock/Interface/AttachInstances.hs @@ -25,7 +25,12 @@ import GHC import Name import InstEnv import Class -import HscTypes (withSession, ioMsg) +#if MIN_VERSION_ghc(7,1,0) +import GhcMonad (withSession) +#else +import HscTypes (withSession) +#endif +import MonadUtils (liftIO) import TcRnDriver (tcRnGetInfo) import TypeRep hiding (funTyConName) import Var hiding (varName) @@ -93,7 +98,9 @@ lookupInstDoc name iface ifaceMap instIfaceMap = -- | Like GHC's getInfo but doesn't cut things out depending on the -- interative context, which we don't set sufficiently anyway. getAllInfo :: GhcMonad m => Name -> m (Maybe (TyThing,Fixity,[Instance])) -getAllInfo name = withSession $ \hsc_env -> ioMsg $ tcRnGetInfo hsc_env name +getAllInfo name = withSession $ \hsc_env -> do + (_msgs, r) <- liftIO $ tcRnGetInfo hsc_env name + return r -------------------------------------------------------------------------------- diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs index 57b5627a..f66f862f 100644 --- a/src/Haddock/InterfaceFile.hs +++ b/src/Haddock/InterfaceFile.hs @@ -35,6 +35,9 @@ import UniqSupply import UniqFM import IfaceEnv import HscTypes +#if MIN_VERSION_ghc(7,1,0) +import GhcMonad (withSession) +#endif import FastMutInt import FastString import Unique diff --git a/src/Haddock/Lex.x b/src/Haddock/Lex.x index 4f877fc9..75d44fff 100644 --- a/src/Haddock/Lex.x +++ b/src/Haddock/Lex.x @@ -184,7 +184,11 @@ ident pos str sc cont dflags = strToHsQNames :: DynFlags -> String -> Maybe [RdrName] strToHsQNames dflags str0 = +#if MIN_VERSION_ghc(7,1,0) + let buffer = stringToStringBuffer str0 +#else let buffer = unsafePerformIO (stringToStringBuffer str0) +#endif #if MIN_VERSION_ghc(6,13,0) pstate = mkPState dflags buffer noSrcLoc #else -- cgit v1.2.3