Index: ghc-7.0.2/utils/haddock/src/Haddock/Interface/AttachInstances.hs
===================================================================
--- ghc-7.0.2.orig/utils/haddock/src/Haddock/Interface/AttachInstances.hs	2011-02-28 23:40:13.000000000 +0530
+++ ghc-7.0.2/utils/haddock/src/Haddock/Interface/AttachInstances.hs	2011-03-05 19:05:51.000000000 +0530
@@ -31,7 +31,9 @@
 import HscTypes (withSession)
 #endif
 import MonadUtils (liftIO)
+#ifdef GHCI
 import TcRnDriver (tcRnGetInfo)
+#endif
 import TypeRep hiding (funTyConName)
 import Var hiding (varName)
 import TyCon
@@ -56,7 +58,11 @@
 attachToExportItem iface ifaceMap instIfaceMap export =
   case export of
     ExportDecl { expItemDecl = L _ (TyClD d) } -> do
+#ifdef GHCI
       mb_info <- getAllInfo (unLoc (tcdLName d))
+#else
+      let mb_info = Nothing
+#endif
       let export' =
             export {
               expItemInstances =
@@ -95,12 +101,14 @@
     modName = nameModule name
 
 
+#ifdef GHCI
 -- | 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 -> do 
    (_msgs, r) <- liftIO $ tcRnGetInfo hsc_env name
    return r
+#endif
 
 
 --------------------------------------------------------------------------------
Index: ghc-7.0.2/utils/haddock/src/Haddock/Interface/Create.hs
===================================================================
--- ghc-7.0.2.orig/utils/haddock/src/Haddock/Interface/Create.hs	2011-02-28 23:40:13.000000000 +0530
+++ ghc-7.0.2/utils/haddock/src/Haddock/Interface/Create.hs	2011-03-05 19:04:57.000000000 +0530
@@ -514,7 +514,11 @@
         Nothing -> do
           -- If we can't find the declaration, it must belong to
           -- another package
+#ifdef GHCI
           mbTyThing <- liftGhcToErrMsgGhc $ lookupName t
+#else
+          mbTyThing <- liftGhcToErrMsgGhc $ lookupGlobalName t
+#endif
           -- show the name as exported as well as the name's
           -- defining module (because the latter is where we
           -- looked for the .hi/.haddock).  It's to help people
