aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/GhcUtils.hs
diff options
context:
space:
mode:
authorIsaac Dupree <id@isaac.cedarswampstudios.org>2009-08-23 03:08:03 +0000
committerIsaac Dupree <id@isaac.cedarswampstudios.org>2009-08-23 03:08:03 +0000
commit70945271f1f4deab363c1acfef3ce51a1b7f617d (patch)
tree81d518f2ca4dde1a1c72072b8a67290de2952388 /src/Haddock/GhcUtils.hs
parent9dc98d20af5bbcb8bff7624b3d8c4d840ed6bb4e (diff)
Move doc parsing/lexing into Haddock for ghc>=6.11
Diffstat (limited to 'src/Haddock/GhcUtils.hs')
-rw-r--r--src/Haddock/GhcUtils.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs
index e0202ed6..62b370bb 100644
--- a/src/Haddock/GhcUtils.hs
+++ b/src/Haddock/GhcUtils.hs
@@ -23,12 +23,14 @@ import Control.Arrow
import Data.Foldable hiding (concatMap)
import Data.Traversable
-import HsSyn
-import SrcLoc
import Outputable
import Name
import Packages
import Module
+import RdrName (GlobalRdrEnv)
+import HscTypes
+import LazyUniqFM
+import GHC
moduleString :: Module -> String
@@ -56,6 +58,13 @@ mkModuleNoPackage :: String -> Module
mkModuleNoPackage str = mkModule (stringToPackageId "") (mkModuleName str)
+lookupLoadedHomeModuleGRE :: GhcMonad m => ModuleName -> m (Maybe GlobalRdrEnv)
+lookupLoadedHomeModuleGRE mod_name = withSession $ \hsc_env ->
+ case lookupUFM (hsc_HPT hsc_env) mod_name of
+ Just mod_info -> return (mi_globals (hm_iface mod_info))
+ _not_a_home_module -> return Nothing
+
+
instance (Outputable a, Outputable b) => Outputable (Map.Map a b) where
ppr m = ppr (Map.toList m)