haskell-haddock (2.7.2-5) build_without_ghci.patch

Summary

 haddock.cabal                            |    7 +++++++
 src/Haddock/Interface/AttachInstances.hs |    9 +++++++++
 src/Haddock/Interface/Create.hs          |    4 ++++
 3 files changed, 20 insertions(+)

    
download this patch

Patch contents

Index: haskell-haddock-2.7.2/src/Haddock/Interface/AttachInstances.hs
===================================================================
--- haskell-haddock-2.7.2.orig/src/Haddock/Interface/AttachInstances.hs	2010-07-02 09:13:14.000000000 +0200
+++ haskell-haddock-2.7.2/src/Haddock/Interface/AttachInstances.hs	2010-07-02 09:13:17.000000000 +0200
@@ -27,7 +27,10 @@
 import InstEnv
 import Class
 import HscTypes (withSession, ioMsg)
+#ifdef GHCI
 import TcRnDriver (tcRnGetInfo)
+#endif
+
 import TypeRep hiding (funTyConName)
 import Var hiding (varName)
 import TyCon
@@ -44,7 +47,11 @@
       return $ iface { ifaceExportItems = newItems }
       where
         attachExport export@ExportDecl{expItemDecl = L _ (TyClD d)} = do
+#ifdef GHCI
            mb_info <- getAllInfo (unLoc (tcdLName d))
+#else
+           let mb_info = Nothing
+#endif
            return $ export { expItemInstances = case mb_info of
              Just (_, _, instances) ->
                let insts = map (first synifyInstHead) $ sortImage (first instHead)
@@ -70,10 +77,12 @@
     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 -> ioMsg $ tcRnGetInfo hsc_env name
+#endif
 
 
 --------------------------------------------------------------------------------
Index: haskell-haddock-2.7.2/haddock.cabal
===================================================================
--- haskell-haddock-2.7.2.orig/haddock.cabal	2010-07-02 09:18:05.000000000 +0200
+++ haskell-haddock-2.7.2/haddock.cabal	2010-07-02 09:18:12.000000000 +0200
@@ -67,6 +67,10 @@
   default: False
   manual: True
 
+flag ghci
+  default: True
+  manual: True
+
 executable haddock
   build-depends:
     base >= 4.0.0.0 && < 4.3.0.0,
@@ -139,6 +143,9 @@
     cpp-options: -DTEST
     build-depends: QuickCheck >= 2.1 && < 3
 
+  if flag(ghci)
+    cpp-options: -DGHCI
+
   hs-source-dirs:       src
   extensions:           CPP, PatternGuards, DeriveDataTypeable,
                         ScopedTypeVariables, MagicHash
Index: haskell-haddock-2.7.2/src/Haddock/Interface/Create.hs
===================================================================
--- haskell-haddock-2.7.2.orig/src/Haddock/Interface/Create.hs	2010-03-20 15:47:22.000000000 +0100
+++ haskell-haddock-2.7.2/src/Haddock/Interface/Create.hs	2010-07-02 09:57:33.000000000 +0200
@@ -501,7 +501,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