1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
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
|